-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Suppose I have the following directory tree:
- ./
- foo
- bar
- a/
- foo
- bar
Suppose I want to exclude ./foo, but include everything else -- including ./a/foo.
- If I use
tarsnap -c ... --exclude ./foo ., that excludes both of them. --includeisn't open-ended, so I can't use it without enumerating everything else like ./bar too.- If I use
tarsnap -c ... --exclude /foo ., that doesn't exclude anything.
This comment suggests the possibility of anchored matches for --exclude was considered incompletely and was meant to be re-considered:
Lines 70 to 73 in dfcc22d
| * The matching logic here needs to be re-thought. I started out to | |
| * try to mimic gtar's matching logic, but it's not entirely | |
| * consistent. In particular 'tar -t' and 'tar -x' interpret patterns | |
| * on the command line as anchored, but --exclude doesn't. |
I can use some elaborate system of find(1) patterns piped to tarsnap to achieve the same result, but it would be nice if I could simply specify anchored path patterns in the exclusion file. I think the syntax of --exclude /foo is not currently useful so it could probably be used for this purpose, like in .gitignore files.
I realized this today when I discovered that the exclusion was broader than I intended, resulting in some files not being backed up when I thought they would be for years. (Fortunately, in my case, the files are not important.)