Is there a way to include a subfolder of an excluded parent folder?

Hi,

I’m playing around with configurations, and I’m generally selecting everything in the user profile, but excluding %APPDATA% (in the GUI I have hidden files/folders visible to ensure this is deselected).

So far, so good.

But what it I want to include one or more specific subfolders in %APPDATA%, even though %APPDATA% itself is excluded? I have found no way in the GUI to do this (once the root node of a tree is deselected, you can’t check any of the child nodes), or using the command-line… I thought of just adding something like

  --include="C:\Users\User1\AppData\Local\SomeAppIWant\" 

even though “C:\Users\User1\AppData” is in the --exclude filter.

The GUI doesn’t seem to allow this, and from what I’ve been able to understand in the command line, I’m not sure this is possible to do there in a single backup set.

Perhaps I’ve missed something obvious, any thoughts?

Thanks.
-A

No, that is not possible.

To support that Duplicati would need to scan every single excluded folder and subfolder to find out if some subfolder or file matches.

You can perhaps work around it, with something like:

--include="C:\Users\User1\AppData\Local\"
--include="C:\Users\User1\AppData\Local\SomeAppIWant\*"
--exclude="C:\Users\User1\AppData\Local\*"
--exclude="[C\:\\Users\\User1\\AppData\\[^(Local)].*]"

That would include the Local folder and then subfolder, but exclude everything else (order is very important!).

1 Like

Thanks, will try that later and let you know!

BTW: A good way of showing your appreciation for a post is to like it: just press the :heart: button under the post.

If you asked the original question, you can also mark an answer as the accepted answer which solved your problem using the tick-box button you see under each reply.

All of this also helps the forum software distinguish interesting from less interesting posts when compiling summary emails.

In the GUI isn’t the following sufficient ?:

Filters
Include regular expression: C:\\Users\\User1\\AppData\\Local\\SomeAppIWant\\.*
Exclude regular expression: C:\\Users\\User1\\AppData\\Local\\.*

or the equivalent with command line arguments.

Or, just select just the sub folders you want in the source data pick list.

Unless I misunderstand the question

I think a picture may be a thousand words in this instance… this is an example of what I’m selecting in CrashPlan for one of my user accounts:

Note that I don’t want anything from AppData except certain files or subfolders. However I do want everything from the main profile folder (which is the parent of AppData, now deselected), including any subfolders/files that exist now and any that may be created in the future.

In CP, you select a folder (C:\Users\jt), then can deselect a child folder (C:\Users\jt\AppData), but then (most importantly) you can re-select a child of a child (C:\Users\jt\AppData\Local\Electrum\wallets).

In Duplicati, at least in the GUI, once a folder is deselected from the tree (marked with a red cross), you can’t select any of the child nodes, overriding the choice on the parent node. I’m not sure if this is a bug or a feature :wink:

I’ve been unable to figure out the best way to do this, and have tried all combinations suggested here and then some (and I have now discovered the “test-filters” command-line function!). I know the “easiest” way to do this is just select all the folders I’m interested in directly from the tree, without selecting the main user profile folder (C:\Users\jt). But the downside to this approach is if any new files/folders appear directly under the main folder (e.g. C:\Users\jt\NewFolder), it will not be included in the backup set unless it is explicitly selected…

I should note that if my problem were limited to the user profile folder, it would be a non-issue. It’s unlikely any applications will ever create folders outside the “normal” places. I have a similar selection issue in other general data folders, but decided to use the above as an example of this use-case since everyone (on Windows, at least) is familiar with the above folder structure.

Thanks.
-A

1 Like

It is “as intended” at least… bug or feature is up to you :wink:

If you exclude a folder, you exclude it completely.

Yes, I think this could also work.

A bit laborious though.

Any particular reason why

?

Unfortunately, that doesn’t work, it was the first one I tried yesterday. I’ve created a dummy folder structure to test things out and find the best/easiest solution to this (assume there are files in each of these folders):

D:\DUPLICATI-TESTS
+---AppData
¦   +---Local
¦       +---IDontWantThis_1
¦       ¦   +---Acrobat
¦       ¦   +---Flash Player
¦       +---IDontWantThis_2
¦       +---IWantThis_1
¦       +---IWantThis_2
+---Documents
+---Photos
    +---2016-99 Unsorted
    +---2017-99 Unsorted

The command-line created by the UI is:

Duplicati.CommandLine.exe backup "file://Z:\\" "D:\duplicati-tests\\"  
.... snip ....
--include="[D:\\duplicati-tests\\AppData\\Local\\IWantThis_1\\.*]" 
--include="[D:\\duplicati-tests\\AppData\\Local\\IWantThis_2\\.*]" 
--exclude="[D:\\duplicati-tests\\AppData\\.*]"

(I’ve excluded non-relevant parameters like database path, encryption, etc)

Tried --include and --exclude as both regular expressions (using “[…]”) and standard text filters. I’m using the above command with “test-filters” to see what is being selected, and in all cases I tried, you can’t include a file/folder which is a child of an excluded one.

I’m now trying to flip everything upside-down, and only use an “exclude” filter, where it excludes everything except the folders I want to keep (this is work in progress, doesn’t work yet):

--exclude="[D:\\duplicati-tests\\AppData\\(?!Local\\IWantThis_1\\)]"

I’m making this a feature request cause I’d really like this possibility too…

Guys, really need your help!
try to figure out for several days, how to make it work.
i want to include one file using the filter settings
+\AppData\Local\Google\Chrome\User Data\Default\Bookmarks
but exclude using the filter settings
-
\AppData\Local*\

It will be great, if someone could give an example

According to the discussion above what you’re trying won’t work in the way that you’re trying it.

However, if you invert what you’re doing you might get close to what you want. For example, if you say “exclude everything in the \AppData\Local\ folder that does NOT end with Bookmarks” you should get \AppData\Local\Google\Chrome\User Data\Default\Bookmarks. But you could also get \AppData\Local\Mozilla\Firefox\something\something\darkside\not-really-Bookmarks.

If you want to test it it, I suspect the exclude regular expression field value would look something like:
.:\\Users\\[^\\]*\\AppData\\Local\\.*[^\\Bookmarks]]

Note that I have not tested the above, so if you try it (or similar) out and it works please let us know.

In addition to @JonMikelV 's solution, you can also add the Bookmarks folder as a source folder.
As it would not make sense to include a source folder and then add a filter to remove it, source folders are exempt from the filter rules.

2 Likes

Ah, interesting. But that exception, I assume, is only for the source folder itself, not for any of its subfolders, right?

adding as source folder wont work in multi user evironment, when you have several servers and there 10 user, each of them with there own home directory.
The idea was to backup only some files, that are vital for google chrome recovery and exclude everything else.

Thanx for the idea, can you paste it in plain text format, if possible.
do i need to add any regular expression or filter settings in the filter section in addition to NOT INCLUDE bookmarks settings?
I will report about the result

The plain text version would be the following, but again I haven’t actually tested that it’s correct: :slight_smile:

-[.:\Users\[^\]\AppData\Local\.[^\Bookmarks]]

:frowning: tryed different combinations… this is not the solution :frowning_face:
will try a bit later in the freshly installed testing enviroment…
is there any document or manual, discribing the regular expression syntaxis (possibly with some examples) that can be used with duplicati?

This is the official page, though I think what you’re looking for is more advanced than what it covers: