Looking for rules: Exclude all in this folder except some specified subfolders/files

I would like to do a rules that means “Exclude all in this folder except some specified subfolders/files”
Something like:


Does someone have a solution?

Welcome to the forum @Maelep

Try putting the includes first. You might also need a * on the subfolder to include the things below that.


When filter rules have been defined the first folder is taken and the filter rules are processed one by one. The first rule that matches is applied and the following rules are not processed anymore. For instance, if the first rule excludes a folder, then this folder and all files within will be excluded from the backup even if following rules include this folder or its files. Likewise, if the first rule includes a folder, then it will be included even if a following rule would exclude it.

Thank you for your suggestion but it doesn’t work :frowning_face:

Need description. If it keeps not working, please describe at least the result, or more as you did in GitHub.

To guess, add a drive letter:

C:\mainFolder>tree /f
Folder PATH listing
Volume serial number is ****-****
│   pic.jpeg
│   unwanted_file.txt
│       in_subFolder1.txt
Duplicati.CommandLine.exe test-filters C:\mainFolder --include=C:\mainFolder\subFolder1\* --include=C:\mainFolder\pic.jpeg --exclude=C:\mainFolder\*
Including source path: C:\mainFolder\
Including path due to filter: C:\mainFolder\subFolder1\ => (C:\MAINFOLDER\SUBFOLDER1\*) || (@C:\mainFolder\pic.jpeg)
Excluding path due to filter: C:\mainFolder\unwanted_folder\ => (C:\MAINFOLDER\*)
Including path due to filter: C:\mainFolder\pic.jpeg => (C:\MAINFOLDER\SUBFOLDER1\*) || (@C:\mainFolder\pic.jpeg)
Excluding path due to filter: C:\mainFolder\unwanted_file.txt => (C:\MAINFOLDER\*)
Including path due to filter: C:\mainFolder\subFolder1\in_subFolder1.txt => (C:\MAINFOLDER\SUBFOLDER1\*) || (@C:\mainFolder\pic.jpeg)
Matched 2 files (0 bytes)

Thank you for your suggestion but I don’t manage to get it works.
What I do is:

  1. Create a new backup
  2. Source: C:\Users\myUsername\Documents\myRootFolder\
  3. Create filter as text and

It doesn’t take my filter into account, it backup all file/folder in server.

If I filter like


It ignore + and completely ignore the server folder.

This mixes incompatible styles of specifying the filter. The option style is for command line, not GUI box.
If you set up a job with the + and - style in the Filters box, Export As Command-line can reveal CLI style.

It looks like the prior test which worked (at least the way I did it) used a special case where Source and exclude used the same folder (in my case because I didn’t have lots of folder levels to choose from…).

Source folders:


Commandline list *:
Listing contents 0 (8/17/2021 8:28:58 AM):
C:\mainFolder\pic.jpeg (0 bytes)
C:\mainFolder\subFolder1\in_subFolder1.txt (0 bytes)
Return code: 0

The equivalent for your case would be:



Commandline list *:
Listing contents 0 (8/17/2021 10:01:44 AM):
C:\tmp\myUsername\Documents\myRootFolder\rust\projects\pluginsDevelopment\server\run.bat (0 bytes)

Maybe it’s a contest between the source specification and the exclude, where specifically naming source gives it enough emphasis to persist despite the seemingly conflicting exclude (but not doing so does not).

If there are any filter experts out there, feel free to jump in…

So, the workaround should be to create 2 Backups:

  1. A backup where the source is based on my server folder like your explanation.
  2. The second one should use my default source and ignore the server folder.

First, see if that works for you. If so, great (made at least some progress…).

Duplicati has no default source, but if you mean there is more source than has been discussed, thus you really want Source to start at myRootFolder, I suppose this would work to grab the rest (but please test it).

I found a comment from the main author which supports my thinking about folder as source and exclude:

You can read through the rest of that topic to see if you can make any sense out of it to fit your situation…

I believe this is where sources are exempt from exclusion:

1 Like