Exclude option not working

I’m gonna make a new post, cuz posts I can find are older.

Basically, I exclude the Temp dir and it still gets included.

My command line as exported from the GUI. Specifically look at my excludes:

"C:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" backup
"file://G:\duplicati_backup_storage\\"
"C:\Users\user2\\"
"C:\Users\user1\\"
--backup-name="user user1 and user2 all files"
--dbpath="C:\ProgramData\Duplicati\Data\80898885857587717782.sqlite"
--encryption-module=aes --compression-module=zip --dblock-size=50mb
--passphrase=mypassphrase --thread-priority=idle
--use-background-io-priority=true --snapshot-policy=On
--log-file="C:\path\job_log_file.log" --log-file-log-level=Verbose
--disable-module=console-password-input
--exclude="*/AppData/Local/Temp*"
--exclude="*/Google/Chrome/*cache*"
--exclude="*/Google/Chrome/Safe Browsing*"
--exclude="*/Mozilla/Firefox/*cache*"
--exclude="*/Temporary Internet Files/"
--exclude="*/Safari/Library/Caches/"

Specifically, let’s look at this exclude:

--exclude="*/AppData/Local/Temp*"

And now checking my logfile, I get Temp dir for both users:

2019-02-08 17:01:53 -05 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-IncludingPath]: Including path as no filters matched: C:\Users\user1\AppData\Local\Temp\
2019-02-08 17:01:53 -05 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-IncludingPath]: Including path as no filters matched: C:\Users\user1\AppData\Local\Temp\Low\
2019-02-08 17:01:53 -05 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-IncludingPath]: Including path as no filters matched: C:\Users\user1\AppData\Local\Temp\scoped_dir2168_26689\
2019-02-08 17:01:53 -05 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-IncludingPath]: Including path as no filters matched: C:\Users\user1\AppData\Local\Temp\scoped_dir4328_15648\

2019-02-08 17:04:06 -05 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-IncludingPath]: Including path as no filters matched: C:\Users\user2\AppData\Local\Temp\
2019-02-08 17:04:08 -05 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-IncludingPath]: Including path as no filters matched: C:\Users\user2\AppData\Local\Temp\1096_18517\
2019-02-08 17:04:08 -05 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-IncludingPath]: Including path as no filters matched: C:\Users\user2\AppData\Local\Temp\1096_4936\

Is it flat out broken?

Do I need to use backslashes in my excludes? double backslashes (ie escaped backslashes)?

Since it looks like you’re running on Windows, yes - think you need backslashes:
https://duplicati.readthedocs.io/en/latest/appendix-d-filters/#using-filters

Also note that to match a folder you must end with the slash or backslash - otherwise I believe you’re just matching files.

Ok given your hints, including the entire filters discussion in the manual, I tried using the GUI to “Exclude directories whose names contain” and I specified “temp”. Ie:

image

Selecting “Edit as text” (the 3 dots menu upper right) for that gives (note the BACKslash):

image

Then I exported command line and got (note, again, the BACKslash):

--exclude="*temp*\\"

So, I think you’ve hit the nail (both nails) on the head.

  1. Use backslash for windows
  2. To match dirs, must end with slash (backslash)

(BTW, quote from Manual - Filters - Syntax: “Folder names always end with a slash / on Linux or Mac and a backslash \ on Windows. For instance, log is a file, log/ is a folder.” So, yeah, that one sentence would have corrected both my mistakes. Read That Fine Manual indeed)

Thanks so much!

1 Like

Glad to hear you got it working!

I flagged your post as the solution. :slight_smile:

But why does the command line option end with two backslashes while the “Edit as text” only shows a single backslash?

Welcome to the forum @comecme

“Edit as text” in GUI’s Commandline option doesn’t have to guess where an option ends, due to its line-oriented format which doesn’t need quoting. Export As Command-line tries to set the quoting so a true command line such as a Command prompt or .bat file works (I’m not so sure if it’s right for PowerShell).

Double quotes do things like keep a string together despite an embedded space. Embedding a double quote inside a double quoted string needs embedded double quote to be backslashed, and that’s what would happen (and not be what you want) with a single-backslash-double-quote sequence, so double-backslash becomes a backslash (which is what you need), and the second backslash is then used up.

Parsing C++ Command-Line Arguments

If an even number of backslashes is followed by a double quotation mark, one backslash is placed in the argv array for every pair of backslashes, and the double quotation mark is interpreted as a string delimiter.

1 Like