[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: excluding /*/ and /**/
On Sat, Apr 28, 2018 at 04:36:00AM -0400, Robert Bowers wrote:
> now, i want to exclude any empty.file in a first level directory (relative to /tmp/zzz).
> # cat /tmp/zzz.excludes
> /tmp/zzz/*/empty.file
* matches with / as well. So that will exclude any filename beginning with:
/tmp/zzz/
and ending in:
/empty.file
> ummm. no. the tmp/zzz/?/???/empty.file (s) should be there?
Unfortunately not. As noted in http://www.tarsnap.com/selecting-files.html
the behaviour of --include and --exclude comes from BSD tar. For example,
"In particular, 'a*b' will match 'foo/a1111/222b/bar"
https://github.com/libarchive/libarchive/blob/master/libarchive/archive_match.c#L749
> i thought to do that it would need an exclude like /tmp/zzz/**/empty.file .
> also, if * matches anything or *nothing at all*, why does tmp/zzz/empty.file
> get grabbed as
> # ls -al /tmp/zzz//empty.file
> -rw-r----- 1 root root 0 2018-04-28 08:15 /tmp/zzz//empty.file
> would match?
The normal path listing returns
/tmp/zzz/empty.file
so the exclude doesn't match it. If the filename was printed as
/tmp/zzz//empty.file
or
/tmp/zzz///empty.file
then it would match.
If you wanted to exclude the top-level empty.file, you could use the exclude
/tmp/zzz/*empty.file
I personally find include & exclude rather confusing. Would the nodump flag
work in your case?
http://www.tarsnap.com/selecting-files.html
Cheers,
- Graham