Newsgroups: comp.unix.solaris,comp.unix.programmer,comp.unix.shell,comp.unix.questions
> Could someone out there please tell me how to exclude > files and/or directories from that tar file? I have > read the man page, but for some reason it does not seem > to work. I know that you are supposed to make an exclude > file and list the files/directories to be excluded in it?
The syntax for tar takes a bit of getting used to. You have to tell tar what to do by first giving it a string of one or more “function letters and function modifiers” and then the appropriate aguments. In this case `c' to _create_ an archive and `f' to specify that the archive is a _file_, then `X' which means you are supplying an _exclude-file_
tar cfX t.tar xf file1 file2 file3 *.log anotherfile
xf is the file which contains a listing of files and/or directories to exclude, 1 per line, with no extra spaces.
> One other thing, is it possible to use wildards in the > exclusion, like not take a tar of */netscape/Cache*/*
No, AFAIK.
But you can of course use wildcards to produce the list. E.g.
ls *.tmp *~ > xf ls -d .netscape/cache/[01]*/ >> xf
Manfred Bartz
documented on: 2000.06.10 Sat 21:37:47