I think the instructions for the include/exclude patterns could be improved, but I am myself too unsure of things to make any edits in the wiki. So I’m starting this thread to clarify some things first and once I (or anyone else) has a clear view of things, I/they can edit the wiki.
So, let’s start with the first example under “1. Wildcard matching”:
It is introduced by saying
the following pattern list doesn’t do what is intended, since the foo directory will be excluded so the foo/bar will never be visited
It remains unclear what actually is intended, but it seems that the aim is to include only
foo/bar/* (I don’t understand what difference it makes to say
foo/bar/* instead of
foo/bar/). We are then told that the reason it won’t work (I assume that means: nothing at all will be backed up) is that “the foo directory will be excluded so that foo/bar will never be visited”.
But why is this so? Further up, we are told that
the order of the patterns is significant. If a match with an include pattern is found, the path is said to be included without further comparisons.
If that is the case, then that means, the first thing that duplicacy finds in the filter file is
+foo/bar/*, which means, the first thing it will do is to include that path “without further comparisons”. Only then will it find the
-* and exclude everything, i.e. everything else. So, it is not clear to me why “the foo directory will be excluded so that foo/bar will never be visited”.
Anyway, if I accept that there is a problem with the first example, I nevertheless don’t understand why the second example is the (best) solution:
+foo/bar/* +foo/ -*
Looking at that example, it strikes me that the first and last line end with an asterisk but not the second one. My hunch is that this is because we only want to include the foo directory, but not everything in it (though it sounds strange to say you want a directory but not its contents). But if the idea is that foo needs to be included so that duplicacy will foo/bar at all, then why does
+foo not come first, i.e. before
Ironically, the third example makes sense to me:
-foo/bar/ +foo/* -*
Perhaps it’s because the only thing we are told about that example is that it “includes only files under the directory foo/ but not files under the subdirectory foo/bar”, which means there is not so much room for discovering incoherences…
The way I interpret each line is like this:
-foo/bar/: we exclude foo/bar/ before including anything else, because whatever comes first tales priority over what comes later. So if foo would first be included first, it would be “included without further comparisons”, which means that we would not be able to exclude any of its subdirectories.
+foo/* Now that we have made sure that foo/bar is excluded once and for all, we can include foo with all its contents (except the ones excluded earlier)
-* Finally, we exclude “everything”, which means “everything except for what has previously been explicitly included” so that we get a backup of everything in foo/, except foo/bar/.
I’d love to hear where I’m wrong because if I continue building my filter file with my current mindset, I’d probably have to completely rework it once I learn how things really work…