I do the following:
rsync --recursive --delete --delete-excluded --exclude-from=$HOME/etc/rsync_exclude.txt --relative --safe-links --executability . /path/to/savedir
Note that the source directory is the working directory (specified as
Inside the working directory, I have a directory
./repository and a file
rsync_exclude.txt contains, among others, the lines
I would have expected that these entries would exceed my
- the leading slash expresses that the names are to be anchored at the root directory for saving, which is the working directory, and
- the trailing slash on repository explicitly states that this is a directory, not a file
However, both entries are copied.
What did I do wrong?
(This is rsync 2.6.9 running on MacOS Sierra (but I don't think this matters in this case)).
When debugging rsync (using
-vv and --dry-run) I can clearly see that all non-anchored rules are accepted (for instance, rsync tells me hiding directory vp5/.git because of pattern .git/), but none of the anchored rules work. I also tried to replace the source directory (.) by ./ or $PWD, but this too did not have any effect.
Furthermore, when I remove the leading / (for instance, turning /repository/ into repository/), the directory is excluded. Of course this directory would now be excluded anywhere in the tree, which doesn't harm in this particular case, but is not what I want in general).