[Sunhelp] gnu tar question

Doug McLaren dougmc at frenzy.com
Sat Jul 22 00:32:49 CDT 2000


On Fri, Jul 21, 2000 at 10:15:55AM -0500, Bill Bradford wrote:

| Question - while using GNU tar, is there a way to 
| --exclude a filename *anywhere*?  E.g., what I'm
| doing is backing up a couple of NetApp filers via
| GNU tar to a DLT drive, and I want to *exclude* the
| .snapshot directories everywhere....

   --exclude='*/.snapshot/*'

It may back up the directory itself, but won't get anything underneath
it unless you have a .snapshot in the current directory.  To be
absolutely sure, try something like this -

   --exclude='*/.snapshot'  --exclude='*/.snapshot/*' \
   --exclude='.snapshot/*'  --exclude='.snapshot/*'

If there's any doubt, do your tar manually and tar to /dev/null and
see what it does.

If you have too many exclude statements, put them into a file and use
--exclude-file="whatever".

If you need more flexibility than this, you can do something like this-

   find . -print | egrep -v "whatever|whatever" | \
      tar -cvvvf tape-device --files-from=- - --no-recursion

But of course there's some problems with that idea too ...

-- 
Doug McLaren, dougmc at frenzy.com
Don't you dare tell me what kind of day to have!





More information about the SunHELP mailing list