Exclude Files and Folders via Filter
Files and folders are only considered for synchronization if they pass
all filter rules: They have to match
at least one entry in the
include list and
none of the entries in the exclude list as presented in the filter configuration dialog.
Example: Match items of a folder pair
The following filter phrases assume a folder pair C:\Source <—> D:\Target and
can be used for the include as well as exclude filter.
Description |
Filter phrase |
Single file (or folder) C:\Source\file.txt |
\file.txt |
Single folder C:\Source\SubFolder |
\SubFolder\ |
All files (and folders) named thumbs.db |
*\thumbs.db |
All files (and folders) starting with the Z character |
*\z* |
All *.tmp files (and folders) in C:\Source\SubFolder |
\SubFolder\*.tmp |
Files and folders containing temp in their path |
*temp* |
Multiple entries (separated by vertical bar) |
*.tmp | *.doc | *.bak |
All subfolders of the folder pair |
*\ |
Files/folders inside subfolders of the folder pair |
?*\?* |
All files (but not folders) |
*: |
Example: Complex filter rules with exceptions
Complex filter requirements can often be solved by using
two folder pairs with the
same source and target paths but
different local filter.
The first folder pair handles the default case. The second folder pair the exception.
Exclude a sub folder except for *.txt files by using two folder pairs:
C:\Source <—> D:\Target local exclude filter: \SubFolder\
C:\Source <—> D:\Target local include filter: \SubFolder\*.txt
Example: Exclude empty folders
Set
*: as include filter to match all files, but not folders. During synchronization some excluded folders will still be
created if needed, but only if they contain at least one non-excluded item, that is, when they are not empty.
Note
- For simple exclusions: Instead of typing the filter phrase manually,
go the the FreeFileSync main window,
right-click one or more files from the list,
and exclude via the context menu.
- A filter phrase can match both file and folder paths by default.
To match only one of them, you can give a hint:
1. Files only: | append a colon (:) |
2. Folders only: | append a path separator (/ or \) |
- If the filter is matching a folder, all its files and subfolders are also (implicitly) matched.
Thus the filter phrases SubFolder\ and SubFolder\* are synonymous.
- Both slash (/) and backslash (\) can be used as the path separator character.