Sorry for this long post! But there are so many examples!!!
If Duplicati needs this order (folders first, then files) the GUI should arange filters in this order.
I’ve read this article twice but I still do not understand all the differences between the various possibilities in the gui:
Examples (in preformated text because of slashed and asterisk):
“Exclude directories whose names contain”
I can use an asterisk. But then it is not restricted to a single folder name!
folderpart1*folderpart2 will exclude folderpart1XXXfolderpart2
But it also exludes
folderpart1/xxx/folderpart2
folderpart1xxx/xxx/xxxfolderpart2
folderpart1/folderpart2
And what I really do not understand is the handling of a question mark in this case (it is a single char in windows):
Folderstructure a\b\c\d
--exclude="*?*d*\\"
Excluding path due to filter: c:\temp\testdir\a\ => (*?*D*\)
And "Exclude folder" with "folder" will also exclude /xxxfolderxxx/
Because it is transfered to *folder*
BUT! If I use “Exclude files whose names contain”
This does (maybe only on Windows systems?) not work!
hugo as filter in the GUI becomes
--exclude="[.*hugo.*[^\]]"
and this brings an error
C:\temp\testdir>"C:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" test-filters "c:\temp\testdir\\" --exclude="[.*hugo.*[^\]]"
System.ArgumentException: parsing ".*hugo.*[^\]" - Unterminated [] set.
at System.Text.RegularExpressions.RegexParser.ScanCharClass(Boolean caseInsensitive, Boolean scanOnly)
Correct would be \\ in the regex instead of \
And at last the tile ~ seems to be something really special!
A file filter (Exclude file) ~*xlsx which should filter Temp Excel files becomes
--exclude="~*xlsx"
but this does not exclude the file!
Exclude files whoes names contains ~*xlsx becomes a regular expression
-[.*~*xlsx.*[^\]]
The ^\ is incorrect. So change it to ^\\ and the * after ~ is also not correct this should be a .*
and this still produces an error
C:\Users\myname>"C:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" test-filters "c:\temp\testdir\\" --exclude="[.*~.*xlsx.*[^\\]]"
System.ArgumentException: parsing ".*C:\Users\myname.*xlsx.*[^\\]" - Unrecognized escape sequence \U.
Somehow the ~ is replaced with the home directory. Also [.*[~].*xlsx.*[^\\]] will not work.
After changing to [.*[\x7E].*xlsx.*[^\\]] is runs but the file is not excluded!
Including file: c:\temp\testdir\hugo\~$hugo.xlsx (1,65 KB)
Changing to [.*[\7E].*xlsx.*[^/]] (slash instead of \\) also doesn't exclude the file. Changing to $ at the end does the job!
Excluding path due to filter: c:\temp\testdir\hugo\~$hugo.xlsx => ([.*[\x7E].*xlsx.*$])
My result is that I only use regular expressions because all the possibilities of the GUI are just confusing me!
I think the documentation about filters should be extended to explain for each gui-possibility what it really does.
And it should explain how to treat with special characters (so * ? maybe _ in linux \ / and ~).
In the background it is simple! There are just 2 possibilities:
OS-Filters with * and ? in Windows and I think with * and _ in Linux
Regular Expressions
But the GUI makes it confusing.