For me it was very helpful to think about how duplciacy is handling the filters file when writing the rules:
Duplicacy traverses the filesystem top down, and for each directory and file it encounters it goes through rules one by one from the top until it finds a matching one; it then ignores the rest of the rules, and moves on to the next file or directory. (If it does not find a match – a default rule will be used, which is “exclude” if all the other rules are “include”)
So for you case,
you want it to look into School/ folder, but only backup two specific subfolders.
# This matches only directory itself
+School/
# These match files under the directory.
+School/Bachelor/*
# This matches Work
+Work/*
# Because all rules are "include" the default is "exclude", so the next
# line is not needed, but you can keep it for clarity:
-*
Quiz. What if you want to include all files under /hi/there/hello/
but exclude everything else – including /hi/there/howareyou
?
Answer:
You would need to make sure duplicacy traverses to that last one by including directories only:
+hi/
+hi/there/
+hi/there/hello/*
Note, *
matches everything, including directory separator, and nothing, so doing this:
+hi/there/hello/
+hi/there/hello/*
Would be redundant: Stuff that matches the first line is a subset of stuff that matches the second.
Now, if you have a lot of directores listing them gets very annoying very fast. You can use something like this to visit all directories
+*/
+hi/there/hello/*
The downside – the backup will probably contain massive number of empty directories…
And last bit of advice – use backup
with -dry-run
flag to check your rules: it will go though all the motions without actually uploading anything, so you can verify that the right files are being picked up and/or skipped.
Ok, I’ll go on with unprompted advice.
-
You can include other files in your filters file. For example, you can have
@/Users/Wolfgang/Documents/duplicacy-rules.txt
in the filter file and keep actual rules in that duplicacy-rules file in your documents folder, so you can can backup and replicate it.
-
You can absolve yourself from writing rules by using metadata; on macOS duplicacy honors Time Machine exclusion attributes – everything that is excluded by Time Machine will be skipped by duplicacy when that feature is enabled. Or you can put a special marker files into the folders you want skipped. See -no-backup-file
here set · gilbertchen/duplicacy Wiki · GitHub
Edit 2: missed the question
It now shall be more or less evident, that this can be further simplified to
+School/
+School/Bachelor/*
+School/MBA/*
+Work/*
Edit3: I edited your post to add formatting to configuration files and prevent the forum from misinterpreting things. See more here: Formatting posts using markdown, BBCode, and HTML - Using Discourse - Discourse Meta