The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Listing directories and sub directories jinxor UNIX for Advanced & Expert Users 3 03-11-2008 10:27 AM
moving directories to new directories on multiple servers mackdaddy07 Shell Programming and Scripting 0 04-06-2007 11:30 AM
directories arunkumar_mca UNIX for Dummies Questions & Answers 2 10-14-2004 03:23 AM
what is the . and .. directories ? ssmian UNIX for Advanced & Expert Users 8 03-02-2004 04:30 PM
du -ks on certain directories only Shambo Shell Programming and Scripting 1 09-05-2002 04:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-23-2004
Andysundar Andysundar is offline
Registered User
  
 

Join Date: Dec 2004
Posts: 4
Tar only the Directories and Sub Directories

Hi all,

I want to only tar the Directories and the Sub Directories. I dont want the files which are created in those directories.

Can you please help me out in this issue.

Regards
Andy
  #2 (permalink)  
Old 12-23-2004
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2004
Location: USA
Posts: 511
i do like this ......

Code:

#!/usr/bin/ksh
mkdir tmp
for i in `find . -type d -print`
do
   mkdir -p tmp/$i
done

cd tmp ; rm -rf tmp

tar cvf dirs.tar .
mv dirs.tar ../
rm -rf tmp
  #3 (permalink)  
Old 12-23-2004
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2004
Location: USA
Posts: 511
small modification to remove the tmp dir
cd ..


[code]

#!/usr/bin/ksh
mkdir tmp
for i in `find . -type d -print`
do
mkdir -p tmp/$i
done

cd tmp ; rm -rf tmp

tar cvf dirs.tar .
mv dirs.tar ../
cd ..
rm -rf tmp


[/quote]
  #4 (permalink)  
Old 06-01-2008
pietrozuco pietrozuco is offline
Registered User
  
 

Join Date: Jun 2008
Location: Tokyo
Posts: 1
The script is OK but it do not maintain the ownership and permission of folders.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0