tar: how to exclude subdirectories? | Unix Linux Forums | Filesystems, Disks and Memory

  Go Back    


Filesystems, Disks and Memory Discuss NAS, SAN, RAID, Robotic Libraries, backup devices, RAM, DRAM, SCSI, IDE, EIDE topics here.

tar: how to exclude subdirectories?

Filesystems, Disks and Memory


Tags
tar, tar exclude

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-15-2002
kymberm kymberm is offline
Registered User
 
Join Date: Mar 2002
Last Activity: 27 April 2005, 11:36 AM EDT
Location: Texas
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Sponsored Links
    #2  
Old 10-15-2002
Kevin Pryke Kevin Pryke is offline
Registered User
 
Join Date: Feb 2002
Last Activity: 5 November 2012, 12:05 PM EST
Location: Bradford, UK
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Theres a link a thread here
Sponsored Links
    #3  
Old 10-15-2002
kymberm kymberm is offline
Registered User
 
Join Date: Mar 2002
Last Activity: 27 April 2005, 11:36 AM EDT
Location: Texas
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
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?
    #4  
Old 10-15-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 23 August 2014, 1:36 AM EDT
Location: Ashburn, Virginia
Posts: 9,920
Thanks: 59
Thanked 431 Times in 257 Posts
I think you're using single quotes when you want back quotes.
Don't use ' when you want `
Sponsored Links
    #5  
Old 10-15-2002
kymberm kymberm is offline
Registered User
 
Join Date: Mar 2002
Last Activity: 27 April 2005, 11:36 AM EDT
Location: Texas
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Sponsored Links
    #6  
Old 10-15-2002
kymberm kymberm is offline
Registered User
 
Join Date: Mar 2002
Last Activity: 27 April 2005, 11:36 AM EDT
Location: Texas
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Sponsored Links
    #7  
Old 10-15-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 23 August 2014, 1:36 AM EDT
Location: Ashburn, Virginia
Posts: 9,920
Thanks: 59
Thanked 431 Times in 257 Posts
This trick will not work for lengthy lists of files. Yours is too long.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[Solved] Using Find with an exclude/exclude file metallica1973 Ubuntu 2 10-23-2011 10:07 AM
Tar exclude haezeban SCO 2 01-26-2010 11:28 AM
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 01:42 PM
Exclude & Zip dreams5617 Shell Programming and Scripting 1 02-11-2007 07:01 PM
Getting 'tar' to exclude kuultak UNIX for Dummies Questions & Answers 6 02-07-2005 06:31 PM



All times are GMT -4. The time now is 03:15 PM.