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

Go Back   The UNIX and Linux Forums > Special Forums > Hardware > Filesystems, Disks and Memory
.
google unix.com



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

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-15-2002
kymberm kymberm is offline
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?
  #2 (permalink)  
Old 10-15-2002
Kevin Pryke Kevin Pryke is offline
Registered User
  
 

Join Date: Feb 2002
Location: Bradford, UK
Posts: 70
Theres a link a thread here
  #3 (permalink)  
Old 10-15-2002
kymberm kymberm is offline
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?
  #4 (permalink)  
Old 10-15-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,119
I think you're using single quotes when you want back quotes.
Don't use ' when you want `
  #5 (permalink)  
Old 10-15-2002
kymberm kymberm is offline
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.
  #6 (permalink)  
Old 10-15-2002
kymberm kymberm is offline
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?
  #7 (permalink)  
Old 10-15-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,119
This trick will not work for lengthy lists of files. Yours is too long.
Closed Thread

Bookmarks

Tags
tar, tar exclude

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 10:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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