Manual: Exclude Items

Get help for specific problems
Posts: 2
Joined: 14 Aug 2019

Choggo

Hi there. Would very much appreciate it if someone would be kind enough to shed some light on this example from the FFS manual pages:
Example: Exclude a sub folder except for certain files
Set up two folder pairs with the same source and target paths but with distinct local filters:
Folder pair 1; local exclude filter: \SubFolder\
Folder pair 2; local include filter: \SubFolder\*.txt
I simply cannot quite grasp why the second rule doesn't suffice here/why we need to make two duplicate folder pairs with these rules to achive a sync of just .txt files from SubFolder.

Thanks in advance!
User avatar
Posts: 2267
Joined: 22 Aug 2012

Plerry

As per the manual page on In-and Excluding files:
Files have to match at least one entry in the include list and none of the entries in the exclude list
Just an Include filter of \SubFolder\*.txt (as per your suggestion), would only sync any *.txt files in \Subfolder\ or any of its sub-subfolders, but none of the other (*.txt or other type) files anywhere else in the left and right base location.

If you only want to sync the *.txt files in \Subfolder\ (and no other files anywhere) you could indeed do that per an Include filter \Subfolder\*.txt.
Alternatively, you can define your base folder pair more in detail, e.g.
\[path_to_parent_of_Subfolder]\Subfolder\ and use an include filter of *.txt.

However, that is not what that manual section on including and excluding is about.
That section describes a case where you want to sync everything in your base locations (i.e. all files in the root of the base locations and any of its subfolders) except for the files in \Subfolder\, of which you only want to sync all *.txt files.
In that case you need a first sync pair with the left and right base locations defined as the parent folder of \Subfolder\, have the standard Include filter of * (everything), and an Exclude filter of \Subfolder\ (plus some standard exclude items, excluding some temp- and recycle related files). This part will sync all files in the root of the base locations and any of its subfolders) except for any files in \Subfolder\.
In order to add the *.txt files in \Subfolder\ to the sync, you need to define that second left-right pair.
That second left-right pair may be the same as the first left-right pair, but now use a (local!) Include filter \Subfolder\*.txt and a (local) Exclude filter that does not exclude \Subfolder\.
As described above, alternatively the second left-right pair may point more in detail to Subfolder, in which case you would use a (local) Include filter *.txt and an empty or default (local) Exclude filter.
Posts: 2
Joined: 14 Aug 2019

Choggo

Understood.

Thank you very much for the detailed reply. Much appreciated!