I’ve been having usability issues with how the filters are implemented and have some feedback.
According to gilbertchen here the filters “borrows … model from rsync” but there are some differences (and I realize gilbertchen said borrows and itsn’t necessarily going to be completely compatible)
Wildcards match slashes
Duplicacy filters ‘*’ matches any character
However in rsync:
- ‘*’ matches any path component, but it stops at slashes.
- use ‘**’ to match anything, including slashes.
- ‘?’ matches any character except a slash (/).
That means you can’t use standard patterns to only match for filenames or to not recurse indefinitely.
For example if I wanted to exclude a certain folder under all users folder this filter would not work the same as in rsync:
-home/*/exclude/
As it would inadvertently also match
home/user/documents/exclude/
The only way around this currently is do use a regexp. It would be great to have *
and ?
not match slashes and to implement **
for matching.
Hard to match against items in root
Also the lack of a beginning slash in how the filters are processed causes some headaches.
For example if I wanted to exclude a folder in the root, but also any subfolders, I have to define the filter twice:
-exclude/ #match root
-*/exclude/ #match subfolders
If the root files/folders were evaluated with a slash at the beginning then only one filter would be required:
-*/exclude/ # would match both root and subfolders
Wanted to know other peoples thoughts on the above, they would both potentially be breaking changes to how filters currently work, but they are more intuitive to me and would reduce the number of regexps and duplication I have to use in my filters.