How I can add to backup only *.au3 and *.exe files from a source?

So I have a backup job and want to add from another source only file with *.exe and *.au3. How I can add this?

I try to add two variants:

  1. Add to Source “C:\Path*.exe” or
  2. Add to Source “C:\Path” with --exclude=“C:\Path*” and --include=“C:\Path*.exe”.

But they didn’t work.

There is a good article on filters here: Filters • Duplicati

Specifically they state

Per default, all files and folders will be backed up. That means, if no rule matches, the file or folder will be included. In the special case that all rules are include rules (which does not make sense when all files and folders are included per default) Duplicati assumes that all other files and folders are meant to be excluded

So if you remove your exclude rule and only --include="C:\Path*.exe then it should work the way you want it

1 Like

Thank you. So I haven’t to add to Source but add to filters: --include="C:\Path*.exe"

If yes, it isn’t worked. “Path” didn’t added to result after test-filters.

Does nobody know?)))

Example task.

I have a folder structure:

d:\test\Dir1
d:\test\Dir2
d:\test\Dir3
d:\test\NecDir
d:\test\Dir1\khkh.txt
d:\test\Dir3\khkh - Copy.txt
d:\test\Dir3\khkh.txt
d:\test\NecDir\Path1
d:\test\NecDir\Path2
d:\test\NecDir\Path3
d:\test\NecDir\Path1\File1.au3
d:\test\NecDir\Path1\File2.docx
d:\test\NecDir\Path1\Path1
d:\test\NecDir\Path1\Path2
d:\test\NecDir\Path2\File12.au3
d:\test\NecDir\Path2\Filesss2.docx
d:\test\NecDir\Path3\File12.au3
d:\test\NecDir\Path3\Filesss2.docx

I need to add only d:\test\NecDir\*.au3 and d:\test\NecDir\*.docx:

d:\test\NecDir\Path1\File1.au3
d:\test\NecDir\Path1\File2.docx
d:\test\NecDir\Path2\File12.au3
d:\test\NecDir\Path2\Filesss2.docx
d:\test\NecDir\Path3\File12.au3
d:\test\NecDir\Path3\Filesss2.docx

How I can do it?

Sorry, if it’ stupid question. But I don’t undestand how --include works).

Stange results:


First variant: I have empty dirs in backup. I don’t undestand why '*" was included to my backup?
Second variant: I have no files. But why whole dir was excluded? Why not only end-point dir?

I don’t think I follow what it is you’re trying to do.

You want ONLY paths that include .au3 and .docx files in them? If so then this is the section of the Filters link above that should apply:

Include specific files only. You have a folder structure that contains a lot of photos and movies from your camera. For some reason you only want to include the photos to your backup. The rule for your backup is +.jpg +.jpeg.

To do this for your file types, in the GUI you’d want to select “Include expression” and put *.au3 then do another “Include expression” and put *.docx.

In your second variant above, you told Duplicati to exclude anything that was a folder. Since exclude rules take precedence over include rules, you effectively ran your job with NO includes.

Thank you. It’s my first variant, is? If so, how I can exclude empty folders from backup?

Second question: how I can exclude folder insude D:\Test\NesDir ? For example: D:\Test\NecDir\Path1\Path2\ and D:\Test\NecDir\Path1\Path1\ ?

Or you can use “Include Regular Expression”. I have made an example a few minutes ago for an exclusion of bak and tmp files. This can also be used for an include definition. Have a look here

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

can also be used as

--include="[.*\.(au3|exe)$]"

Do you mean: Duplicati.CommandLine.exe test-filters "D:\Test\\" --include="[.*\.(au3|docx)$]" ?

If so, then why empty dirs or dirs without allowed extension was added to backup?

You might be able to use an exclude regular expression that excludes anything that does NOT end with .au3 or .docx, but I haven’t tested that yet.

Why are you worried about empty paths? Actually, have you tried doing a test restore to see if those empty paths are stored in the backup? It’s possible the “Including path due to filter” message may mean that it’s including that path when scanning for files rather than actually including it in the backup…

1 Like

Adding to @JonMikelV, you cannot remove the folders. Duplicati needs to include the folders, otherwise it will not look inside for the files. If you exclude all folders you also exclude the files.

In an earlier version we had an --exclude-empty-folders option, but this has not been implemented again.

1 Like

Thanks to @JonMikelV and you. In restore I have not empty folders what excluded files. I don’t know about other cases.

So it’s good works now. But better if will be more clear for new users. Also about this: “Duplicati needs to include the folders, otherwise it will not look inside for the files. If you exclude all folders you also exclude the files.”.