Help with filters

If have read the documentation about filters Filters • Duplicati but I am sill confused.

My wish is to exclude some top-level folders (windows system).

\\host\share\folder1
\\host\share\folder2
\\host\share\folder2\folder1
\\host\share\mayby later some more directories

So exclude \folder1
BUT: still include \folder2\folder1
AND: It is no an option to backup just folder2 because if a “mayby later some more directories” are created this should also be backuped.

So I tried (in the gui) with “Exclude Folder”

folder1
\folder1
folder1\
\folder1\
\\host\share\folder1
\\host\share\folder1\

In the commandline the \ from the gui at the end is doubled so I tried the variations with test-filters but folder1 was never excluded.

With *\folder1* folder1 is excluded But then also folder2\folder1 is excluded.
With \folder1* folder1 was not excluded.
With \\host\share\folder1* folder1 was also not excluded.

So I have 2 questions:

First: How does “Exclude Folder” work?
Seconds: How can I exclude a top-level directory without excluding the same directory in subdirectories?

Good call on reading through the Filters link - unfortunately, working with filters can be complicated so I fully understand your confusion.

I believe there is a bug in the test-filters command via the GUI (but possibly not the CLI), but I don’t know that it has ever been confirmed:

Are you backing up a UNC connection or just not sharing drive letters (C:) in your example top-level folders?

If it’s a UNC connection, then the problem is likely that the UNC starts with a slash so ends up including matching subfolders since they also start with a slash.

Hello JonMikeIV,

I used test-filters with the GUI and I only use UNC-path for all my backup jobs. For source and for target (expect the “remote” targets were I use various clouds, ssh and webdav).

Now I tried with the CLI test-filters and so I found 2 ways.

I can exclude the full qualified path in the GUI with “Exclude Regular Expression”.

Duplicati.CommandLine.exe
test-filters
\\host\share\
--exclude=[\\\\host\\share\\folder1\\.*]

Or I can use “Exclude Expression” also with a full qualified path

Duplicati.CommandLine.exe
test-filters
\\host\share\
--exclude=\\host\share\folder1\

So there is no way to exclude a top level folder with it’s relative name.

Works for me. Thanks!

Glad you found a solution! (I went ahead and flagged your post as the fix.)

If you have time, can you confirm that running an actual backup works the way the CLI test-filters showed it would? Oh, and that running the same test-filters command in the GUI shows incorrect results? Thanks!