On Monday 10 January 2011 02:34:13 Alex Schuster wrote: > I created two directories sys/ and usr/include/sys/, with normal and > hidden files: > > wo...@weird ~/tmp/tar $ ls -a . sys usr/include/sys > .: > . .. sys usr > > sys: > . .. .hidden visible > > usr/include/sys: > . .. .hidden.h visible.h > > > I tarred them as you did. Note that the hidden file is also excluded, > although I did not exclude sys/.*, too: > > wo...@weird ~/tmp/tar $ tar cf ../foo.tar --exclude='sys/*' . > wo...@weird ~/tmp/tar $ tar tf ../foo.tar > ./ > ./usr/ > ./usr/include/ > ./usr/include/sys/ > ./sys/ > > > As suggested, I added a './' to the exclude file list and tarred the > directory. Seems to work: > > wo...@weird ~/tmp/tar $ tar cf ../foo.tar --exclude='./sys/*' . > wo...@weird ~/tmp/tar $ tar tf ../foo.tar > ./ > ./usr/ > ./usr/include/ > ./usr/include/sys/ > ./usr/include/sys/visible.h > ./usr/include/sys/.hidden.h > ./sys/ > > > What shall I use for excluding all the contents of a directory, but > > not the directory itself? > > sed -i 's:^:./:g' file.list
Thank you very much - I also repeated your findings. My confusion was whether the list passed to -X should be defined as an absolute path, or a pattern. When I originally tried /dir it didn't work, but as you say ./tmp does. Good trick about mount -o bind, too, I had forgotten about that. -- Regards, Mick
signature.asc
Description: This is a digitally signed message part.