Couple of gotcha's I came across with filters

Filters does not like Unicode with BOM format files. I was using Set-Content -Encoding utf8 for generating the filters file, and upon debug the first filter is corrupt (extra spurious chars at beginning)

Filtering a junction (mklink /J) is not treated as a directory

myjunction/ does not match
myjunction matches

So to include a set of descendent folders I had to

+myjunction
+myjunction/dir2/
+myjunction/dir2/dir3/
+myjunction/dir2/dir3/dir4/*

These had me stumped for a while. The duplicacy -log -d backup -dry-run command was very useful in finding out what was wrong.

In CLI 2.3.0 if a symlink turns out to be a directory then the trailing / is added and it is matched agains the patterns again. Particularly, it is this commit:

4 Likes

[rant]

If it’s an utf-8 file with BOM, then its an abomination which should die already (screaming at microsoft -but not only- about this). Here’s from The Unicode Standard, Version 12.0:

Use of a BOM is neither required nor recommended for UTF-8

[\rant]

Set-Content -Encoding utf8

Rant away :slight_smile:

2 Likes