Option to exclude in test-filters result string when exclude: "=> (*.BAK) || (*.TMP) || (*.~*)"

I think it’s be useful string, because if you have many filters it’s very disturbing.

Or may be should be the reason of exclude (without “or” / “II”).

You can use a regular expression for things like that.

--exclude="[.*\.(bak|tmp)$]"

Does the job:

"Duplicati.CommandLine.exe" test-filters "c:\temp\test\\" --exclude="[.*\.(bak|tmp)$]"

Including source path: c:\temp\test\
Including folder: c:\temp\test\
Excluding path due to filter: c:\temp\test\hugo.bak => ([.*\.(bak|tmp)$])
Including file: c:\temp\test\hugto.baka (374 Bytes)
Including folder: c:\temp\test\x.bak\
Including file: c:\temp\test\x.bak\test (328 Bytes)
Matched 2 files (702 Bytes)

Files with .bak AT THE END are excluded but a directory .bak is included!

Yes, but sometimes I need to exclude empty dirs or dirs without added files. Can I do this?

Yes you can. With regex you can rule the world :smile:

Exclude a directory with a given name but include a file with the same name:

C:\temp>"c:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" test-filters "c:\temp\test\\" --exclude="[.*\\hugo3\.bak\\]"
Including source path: c:\temp\test\
Including folder: c:\temp\test\
Excluding path due to filter: c:\temp\test\hugo3.bak\ => ([.*\\hugo3\.bak\\])
Including file: c:\temp\test\hugo.bak (326 Bytes)
Including file: c:\temp\test\hugo2.bak (374 Bytes)
Including folder: c:\temp\test\test\
Including file: c:\temp\test\test\hugo3.bak (462 Bytes)

Or you can exclude directories that end with .bak but include files with .bak

C:\temp\test>"c:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" test-filters "c:\temp\test\\" --exclude="[.*\.bak\\]"
Including source path: c:\temp\test\
Including folder: c:\temp\test\
Excluding path due to filter: c:\temp\test\hugo3.bak\ => ([.*\.bak\\])
Including file: c:\temp\test\hugo.bak (326 Bytes)
Including file: c:\temp\test\hugo2.bak (374 Bytes)
Including folder: c:\temp\test\test\
Including file: c:\temp\test\test\hugo3.bak (462 Bytes)

Or exclude .bak-Files but include .bak-Directories

Including source path: c:\temp\test\
Including folder: c:\temp\test\
Excluding path due to filter: c:\temp\test\hugo.bak => ([.*\.bak$])
Excluding path due to filter: c:\temp\test\hugo2.bak => ([.*\.bak$])
Including folder: c:\temp\test\test\
Excluding path due to filter: c:\temp\test\test\hugo3.bak => ([.*\.bak$])
Including folder: c:\temp\test\hugo3.bak\
Including file: c:\temp\test\hugo3.bak\test (328 Bytes)

Or exclude both. Files that end with .bak and Directories that end with .bak but include files with .bakxxx

Including source path: c:\temp\test\
Including folder: c:\temp\test\
Excluding path due to filter: c:\temp\test\hugo3.bak\ => ([.*\.bak($|\\)])
Excluding path due to filter: c:\temp\test\hugo.bak => ([.*\.bak($|\\)])
Excluding path due to filter: c:\temp\test\hugo2.bak => ([.*\.bak($|\\)])
Including file: c:\temp\test\test.bakxxx (511 Bytes)
Including folder: c:\temp\test\test\
Excluding path due to filter: c:\temp\test\test\hugo3.bak => ([.*\.bak($|\\)])
3 Likes

Thank you for all.

Uhhh… Regex is too hard for me)) and think most of people.

BTW, about tes-filters: may be exists or may be it will be nice feature to optionally exclude strings begining "Excluding path due to filter: ".

I do not understand what you mean. Can you give an example?

If you want to try regex you can use this to learn: https://regex101.com/
There you have an explanation and a quick reference. You just need to enable multi line if you want to test file paths with line separation:

1 Like