Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!news From: scs@adam.mit.edu (Steve Summit) Newsgroups: comp.unix.internals Subject: Re: more uses for mode 000 (will be: cat -v considered harmful) Message-ID: <1991Feb12.043341.29652@athena.mit.edu> Date: 12 Feb 91 04:33:41 GMT References: <1991Feb10.221410.2345@athena.mit.edu> Sender: news@athena.mit.edu (News system) Reply-To: scs@adam.mit.edu Organization: Thermal Technologies, Inc. Lines: 52 In article <1991Feb10.221410.2345@athena.mit.edu>, I wrote: > chmod 000 $HOME/subdir/hugedir > cd $HOME > tar c . >... >Admittedly, there are other ways of solving these problems... In article clark@cme.nist.gov (Steve Clark) writes: >cd $HOME >echo ./subdir/hugedir | tar cX - . > >Is this not portable? Well, I did imply that there were other ways. This will probably spark a big "cat -v considered harmful" flamefest, but I'll opine that adding this tar X option wasn't very worthwhile. The right way to exclude files matching some pattern is tar c `find . -print | grep -v pattern` Now, Unix is far less restrictive than most operating systems on things like command line length limitations, but this is one case where you can overload even the generous allotments that the shells (and exec) give you. Therefore, a wrinkle that *is* a worthwhile addition to tar is a way to read a list of filenames from a file, or from standard input. I once implemented this as tar c -R file_of_files ('R' for recursive; I don't remember if it was my idea or if I patterned it after somebody else's.) GNU tar has the same idea, but they named it -T, and it does work with `-' for stdin. It seems to me I've seen a third option, for reading filenames from stdin only, which didn't involve a special flag character; perhaps it was something like tar c - In any case, with an option like this we can do something like find . -print | grep -v pattern | tar c -T - and there's no need to build regexp handling into tar. (Sure, with a regexp library it's easy enough, but why bother?) I don't know how widespread -T is (or that third option I can't remember). I see that BSD tar has neither -T nor -X. Steve Summit scs@adam.mit.edu