Exclude Files and Folders with Filter
Files and folders are considered for synchronization only if they pass all filter rules:
They must match
at least one entry in the include list and
none in the exclude list as shown in the filter configuration dialog.
Example: Filtering Items in a Folder Pair
The following filter phrases assume a folder pair C:\Source <—> D:\Target,
and they can be used for both the include and exclude filters.
| 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 a vertical bar |
*.tmp | *.doc | *.bak |
| 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 filters.
The first folder pair handles the default case. The second folder pair the exception.
Exclude a subfolder 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 the 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 to the FreeFileSync main window,
right-click one or more files from the list, and exclude them via the context menu.
- By default, a filter phrase can match both file and folder paths.
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 path separators.