Strange Behaviour When Using --exclude During Purge

I think I found a bug when using --exclude with the purge command via the GUI commandline

Let’s say I am using this dataset, already created via Duplicati previously

/sharedfolders/Videos/
/sharedfolders/Music/
/sharedfolders/Others/
/sharedfolders/video1.mkv
/sharedfolders/video2.mkv
/sharedfolders/video3.mkv
/sharedfolders/song1.mp3
/sharedfolders/song2.mp3
/sharedfolders/notes.txt

The plan was to get two copies of this dataset such that:

//Dataset 1
/sharedfolders/Music/
/sharedfolders/Others/
/sharedfolders/song1.mp3
/sharedfolders/song2.mp3
/sharedfolders/notes.txt
//Dataset 2
/sharedfolders/Videos/
/sharedfolders/video1.mkv
/sharedfolders/video2.mkv
/sharedfolders/video3.mkv

So I made two copies of the data and wanted to use the Purge command on each of them

If I were to use the following argument

--include="/sharedfolders/Music/*"
--include="/sharedfolders/Others/*"
--include="/sharedfolders/song1.mp3"
--include="/sharedfolders/song2.mp3"
--include="/sharedfolders/notes.txt"

This works fine for Dataset 1 but the challenge begins with Dataset 2

If I were to use the following argument

--include="/sharedfolders/Videos/*"

The folder “Videos” would be removed but not the individual video files at root directory. It would be ok if the numbers are just a few since I can just purge them individually by identifying them individually per line but I thought I had a better idea.

I tried this argument

--exclude="/sharedfolders/Music/*"
--exclude="/sharedfolders/Others/*"
--include="/sharedfolders/Videos/*"
--include="/sharedfolders/*.mkv"

The following got removed

/sharedfolders/Videos/
/sharedfolders/video1.mkv
/sharedfolders/video2.mkv
/sharedfolders/video3.mkv
/sharedfolders/song1.mp3  //I do not want this removed
/sharedfolders/song2.mp3  //I do not want this removed
/sharedfolders/notes.txt  //I do not want this removed

In other words, it appears that using any --exclude arguments will mean everything from root directory will be included unless specifically excluded by further --exclude arguments.

Or to put it in a more “standard” bug report format:

Expected behaviour: Only specified directories ignored but no other directories excluded/included unless otherwise specified in other arguments
Observed behaviour: Specified directories ignored but all other directories/files included unless specifically excluded in other arguments

May I know if this is intentional by design? Also, how would one be able to solve this problem?

Very old thread… But I have the same problem with the purge so I reanimate it.

I wanted to purge everything expect one folder

–exclude=“\r2016\c\LDEURO*”
–include=“[.*]”

and the dryrun shows this:
[Dryrun]: Purging file \r2016\c\LDEURO.…\somefile (x,xx MB)
[Dryrun]: Purging file \r2016\c\LDEURO.…

Why? The normal filter logic is: determine filter by filter, and if a filter matches stop.

So for this, I would expect for the first file: EXCLUDE matches, so do not purge.

It’s missing a drive letter. This is Windows, right? Use The TEST-FILTERS command to test Filters.

Hello,

no, there is no drive letter missing. The forum swallowed the second backslash!
r2016 ist a hostname and c is a share name and LDEURO is a directory.

I know TESTFILTERS. But the PURGE command works the other way as the filters for eg. BACKUP!

For my backup it works:

  • Have \\r2016\c\ as root
  • EXCLUDE [.*\temp\.*] (for all temp folders)
  • EXCLUDE [.*\\.git\.*]
  • INCLUDE LDEURO with a REGEX
  • EXCLUDE [.*]

So from Share C the folders defined with REGEX are all included but TEMP or .git Folders in this folders are excluded and everything else in C is excluded.

This work fine in the backup!

Now for PURGE I tried the same. Purge everything, that is not LDEURO.

So EXCLUDE LDEURO with REGEX
and INCLUDE everything.

Putting single (or in some cases triple) backticks around the item can avoid character interpretations.

So that’s a change from before, when it was a wildcard? In a regex, backslashes have to be doubled.

This is hard to piece together. Maybe you can post your lines, using triple backticks above and below.
Even better, post what test-filters does, if you can come up with a small tree that’s similar to real.

Ok. I’m sorry for the missleading Backslash things.

To clearify: The Regex includes/excludes work fine in the BACKUP COMMAND => so I think the regex strings itself are correct.

For the purge command, I edited the backup command a little bit. I removed the temp and .git and changed the include to a exclude because this LDEURO should NOT be purged, and the exclude for .* to include because everything else should be purged.

So here the filter in the BACKUP (working)
Source: \\r2016\r\ (2 backslashes at the start and one at the end)

--exclude="[.*\\temp\\.*]
--exclude="[.*\\\.git\\.*]
--include="[\\\\r2016\\c\\LDEURO\\.*]
--exclude="[.*]"

and here the filter in the PURGE, the purge does not have a SOURCE.
This is not working as expected, as you can see on the first LOG Outout (and the initial poster said the same thing):

--exclude="[\\\\r2016\\c\\LDEURO\\.*]
--include="[.*]"

This does not exclude LDEURO-Dir from purging!

I tried now to reproduce it with a simple test backup, but I am not able to…
I will retry it tomorrow.

I am sorry. I cannot reproduce it!

I deleted the whole backup, and then tried again to purge something with exclulde and include and it worked.