Remove files that are excluded or not on source

The option “Remove files not on source” is available for one-way syncs in the Destination tab in the sync item’s settings. If enabled, all files and directories that are not on the source (anymore) and are not excluded will be removed. This option is not visible for two-way syncs since it is standard behaviour to always remove a file from one side if it is removed from the other.

The option “Remove excluded files”, which you can find in the Advanced tab in the sync item’s settings, deletes all files that are excluded by any of the filters in the Exclude tab. As an example, this option can be useful to delete hidden files left over by a previous copy performed in the Finder. In this case it is recommended to enable this option only at the beginning, run the sync once, and then keep it disabled, so that it will leave hidden files such as .DS_STORE files (which store Finder metadata) and the .Spotlight-V100 directory (which contains the Spotlight index) alone.

Exclude files

You can set each sync item to exclude specific files. Excluded files are simply ignored: they are neither copied, nor overwritten, nor removed (unless the option “Remove excluded files” is enabled). However, excluded files inside directories to be removed are only preserved if they are explicitly included (i.e. they appear in the “Following files” section described afterwards).

In the Exclude tab of a sync item’s settings you will find the following options.

Exclude hidden files

Files or directories which start with a dot are hidden in the Finder. Most of the times these files are used to cache data and can be recreated by macOS if necessary. For example, “.DS_STORE” files are created by the Finder when opening a directory and are used to store information about the position of icons. If the confirmation dialog lists hidden system directories like “.DocumentRevisions-V100”, “.Spotlight-V100”, “.TemporaryItems” or “.Trashes”, it usually means that you have selected an external device’s root folder as the source and/or destination; instead, it is recommended that you create a dedicated directory to store your backup so that these hidden directories managed by the operating system don’t get in the way.

Excluding hidden files can be convenient if you know well all the important data that you want to back up and don’t care about files you can’t see in the Finder. If you are unsure, try to run a sync without any exclude filter and in the confirmation dialog check if there are any files you don’t care about. If you find that after all you need some of the hidden files, you can simply exclude the unwanted files with one of the filters below. For example, if you don’t care about the “.DS_STORE” files but want to copy other hidden files, just add “.DS_STORE” as a filename filter below.

Filename filters

After enabling the check box “Filenames containing any of the following words”, you can enter a list of tokens which are checked against each filename in order to determine if it should be excluded or not. After typing an expression, you have to press Return in order to tokenise it. You can then turn a token into a regular expression and/or from exclusive to inclusive by clicking on the small triangle on its right. Tokens at the start of the text field have higher priority, meaning that if a file is matched by an inclusive token but also by a following exclusive token, it will be included.

Be careful when using inclusive tokens in combination with explicitly excluded directories (see below): since inclusive tokens always cause excluded directories to be scanned, this could lead to higher than normal scanning time.

Exclude a specific file

Add a file to the list under the “Following files” check box by clicking on the “+” button. Files inside excluded directories will be included, and vice versa; you can alternate as many excluded and included files as you want. Excluded and included files apply for both source and destination. Files contained in included directories can still be excluded and files contained in excluded directories can still be included by the above filters.

You may want to exclude the source directory itself and include some of the contained directories as a means of grouping together many sync items with a common parent directory and the same settings, or to sync regular files or file packages that you cannot select individually as a source.