You are not logged in.
Yesterday I discovered that the --exclude flag could be used with GNU tar to list only to a certain depth:
$ tar --exclude="*/*/*" -tf pentadactyl-git.txz
pentadactyl-git/
pentadactyl-git/pentadactyl/
pentadactyl-git/src/BSD tar also has an exclude flag, but using just the '*' glob it can't seem to produce the same result:
$ bsdtar --exclude="*/*/*" -tf pentadactyl-git.txz
pentadactyl-git/
$ bsdtar --exclude="*/*/*/" -tf pentadactyl-git.txz
pentadactyl-git/
$ bsdtar --exclude="*/*/*/*" -tf pentadactyl-git.txz
pentadactyl-git/
pentadactyl-git/pentadactyl/
pentadactyl-git/src/
pentadactyl-git/pentadactyl/description
pentadactyl-git/pentadactyl/config
pentadactyl-git/pentadactyl/packed-refs
pentadactyl-git/pentadactyl/HEADHowever, I discovered that adding a '?' works, at least in my limited testing:
$ bsdtar --exclude="*/*/?*" -tf pentadactyl-git.txz
pentadactyl-git/
pentadactyl-git/pentadactyl/
pentadactyl-git/src/It seems to me that globbing should be pretty standardized, and thus one of these must be a bit off. I don't even really understand why adding the '?' works. That lack of understanding isn't helped by the fact that GNU tar produces the same result for "*/*/*" and "*/*/?*". Any thoughts?
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline
* normally means zero or more characters. Then the paths
pentadactyl-git/pentadactyl/
pentadactyl-git/src/both match "*/*/*" (the last * matches an empty string) and so it makes sense to me to see bsdtar exclude them.
? stands for any single character, so with that added the empty string doesn't match and these two paths are no longer excluded.
A quick look at GNU tar's man page doesn't tell me anything about why it behaves differently. Perhaps directories get special treatment somehow.
Offline