[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: excluding files w/ tar (retraction)



One way to test exclude patterns is with 

tar -c --exclude=pattern  includedirectorys | tar -t - 

Unfortunately, I didn't run such a test before responding to the
original poster, and now that I have I would like to retract my previous
posts on the subject.  Sorry!

The examples below show that the stripping of the leading / by tar is
not the issue as I thought it was.

$ rm -fr /tmp/{a,b}
$ mkdir -p /tmp/a/b /tmp/b/tmp/a/c 

$ tar -c --exclude=nothing  /tmp/{a,b} | tar -t -f -
tar: Removing leading `/' from member names
tmp/a/
tmp/a/b/
tmp/b/
tmp/b/tmp/
tmp/b/tmp/a/
tmp/b/tmp/a/c/
#everything is listed, as expected

$ tar -c --exclude=/tmp/a  /tmp/{a,b} | tar -t -f -
tar: Removing leading `/' from member names
tmp/b/
tmp/b/tmp/
tmp/b/tmp/a/
tmp/b/tmp/a/c/
# the desired result

$ tar -c --exclude=tmp/a  /tmp/{a,b} | tar -t -f -
tar: Removing leading `/' from member names
tmp/b/
tmp/b/tmp/
# not the desired result

Winston



Reply to: