[techtalk] Tar options

Laurel Fan lf25+ at andrew.cmu.edu
Tue Jan 23 15:09:38 EST 2001


Excerpts from linuxchix: 24-Jan-101 [techtalk] Tar options by Bek
Oberin at tertius.net.a 
> Anybody know why it's not working????

In the tar info ('info tar exclude' on my machine), it says:
---
   A PATTERN containing `/' excludes a name if an initial subsequence
of the name's components matches PATTERN; a PATTERN without `/'
excludes a name if it matches any of its name components.  For example,
the pattern `*b/RCS' contains `/', so it excludes `blob/RCS' and
`.blob/RCS/f' but not `blob/RCSit/RCS' or `/blob/RCS', whereas the
pattern `RCS' excludes all these names.  Conversely, the pattern `*.o'
lacks `/', so it excludes `.f.o', `d/f.o', and `d.o/f'.
---

Which seems to be a convoluted way of saying that * can't match a /,
or that it acts like * in a shell (like what it would do if you tried
to ls it).

I tried the command
   tar -X foo -cvf asd.tar ~/.netscape
with a few different lines (one at a time) in foo:

worked:
/home/kalana/.netscape/cache*
/home/*/.netscape/cache*
/*/*/.netscape/cache*
/home/kalana/.netscape/cache
/home/*/.netscape/cache
/*/*/.netscape/cache
/home/kalana/.netscape/cache/*
/home/*/.netscape/cache/*
/*/*/.netscape/cache/*

(the difference between the ones with /cache and /cache/ is that the
cache/ includes (ie. does not exclude from the tar) the empty cache
directory. cache and cache* seem to do the same thing.)

didn't work:
*/.netscape/cache*
*/*/.netscape/cache*   # worked when running command in / directory
/home/kalana/.netscape/cache/
/home/*/.netscape/cache/
/*/*/.netscape/cache/

However, from looking at this it seems some other stuff you have
wouldn't be working (like */core)...







More information about the Techtalk mailing list