The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Filesystems, Disks and Memory
Google UNIX.COM


Filesystems, Disks and Memory Questions involving NAS, SAN, RAID, Robotic Libraries, backups, etc go here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 10:42 AM
exclude a line big123456 Shell Programming and Scripting 3 04-24-2008 09:31 AM
Exclude & Zip dreams5617 Shell Programming and Scripting 1 02-11-2007 05:01 PM
Exclude a directory to tar ust UNIX for Dummies Questions & Answers 1 10-12-2005 01:35 AM
Getting 'tar' to exclude kuultak UNIX for Dummies Questions & Answers 6 02-07-2005 04:31 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-15-2002
Registered User
 

Join Date: Mar 2002
Location: Texas
Posts: 120
tar: how to exclude subdirectories?

If i have a bunch of directories that i normally backup with this:
tar cvhf /dev/rmt/0 /export/home

How can i exclude certain subdirectories under the /export/home?

tar cvhf /dev/rmt/0 /export/home | grep -v 'test' ? will that exclude anything named test, and any subdirectories under test?
Reply With Quote
Forum Sponsor
  #2  
Old 10-15-2002
Registered User
 

Join Date: Feb 2002
Location: Bradford, UK
Posts: 70
Theres a link a thread here
Reply With Quote
  #3  
Old 10-15-2002
Registered User
 

Join Date: Mar 2002
Location: Texas
Posts: 120
tar again

Hmm, i followed that thread, came up with some useful info

BUT

i ran the following:

find /export/home /etc /usr | egrep -v "test/" > list.txt
tar cvhf /dev/rmt/0 'cat list.txt'

doesn't work. doesn't like the cat in there. what am i doing wrong?
Reply With Quote
  #4  
Old 10-15-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
I think you're using single quotes when you want back quotes.
Don't use ' when you want `
Reply With Quote
  #5  
Old 10-15-2002
Registered User
 

Join Date: Mar 2002
Location: Texas
Posts: 120
tar exclude

aha, this worked:


#>find /export/home /etc /usr ! -type d -print | egrep 'test/' > Exclude.txt

then
#> tar cvfX backup.tar Exclude.txt /export/home /etc /usr


2 step process. Actually 3 cuz I have to put it on tape, but could put on tape in the 2nd process, skip the tar file.
Reply With Quote
  #6  
Old 10-15-2002
Registered User
 

Join Date: Mar 2002
Location: Texas
Posts: 120
quotes in tar

Darn, this got me before!~ on the date command. THe confusing thing is that ' works in the egrep part of the statement, but have to use ` for the cat part of it! but it says argument listing too long. hmm.

tar cvf /dev/rmt/0 `cat listing.txt` is what i put in. what do you think it's not getting?
Reply With Quote
  #7  
Old 10-15-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
This trick will not work for lengthy lists of files. Yours is too long.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
tar, tar exclude

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0