Configure the task filter to exclude files and folders from a task

This documentation is for an older version of CCC. You can find the latest version here.
Last updated on May 23, 2023

By default, CCC will copy everything from the volume or folder that you specify as the source. If you do not want to copy every item from the source, you can define a task filter to limit what items will be copied. Click the Task Filter at the bottom of the window to open the Task Filter window.

task filter window

Default Filter Behavior

The CCC task filter offers two paradigms for defining the task filter. The default filter behavior determines whether you will define what should be excluded (i.e. everything is copied by default, except for what you specifically exclude), or whether you will define what should be included (i.e. nothing is copied by default, except for what you specifically include). Which behavior you choose depends on what you want CCC to do with new items that are added to the source. You can change the default filter behavior by clicking the button in the top-right corner of the Task Filter window:

Filter mode toolbar item

Exclude: Define what is excluded

CCC's default behavior is to copy everything by default. In this mode you define what is excluded from the task by unchecking the box next to an item in the file list. This mode is simplest for users that only want to exclude a handful of items, but generally copy everything because you don't have to revisit the task filter to indicate that new items should be included in the task. If you add a file or folder to the source (e.g. in the future after defining your task filter), and that item is not in a folder that you have excluded from the task, that item will automatically be included in the task.

Include: Define what is included

In this mode, nothing is copied by default, and you define what is included in the task by checking the box next to an item in the file list. If you add an item to the source in the future, and that item is not in a folder that is specifically included by the task filter, that item will not be copied. This mode is helpful in cases where you only want to copy a handful of items on a volume whose subfolders frequently change.

When the Default Filter Behavior is changed, the task filter is reset

This behavior is intentional, the Include and Exclude Default Filter Behaviors and their rules are mutually exclusive. When you change the Default Filter Behavior, that makes a fundamental change to how each rule is defined by you and interpreted by CCC. As such, all previously-defined rules are inapplicable, so the "conventional" rules are cleared (in contrast to Custom Rules, which are left in place).

Consider this example — suppose the filter is configured to Exclude, and that you have excluded just one folder, "Applications". The task filter has exactly one rule, "Exclude /Applications". If you then change the filter behavior to "Define what is Included", that "Exclude /Applications" rule becomes irrelevant and extraneous. With an "Include" filter, nothing will be copied until you explicitly include it, therefore the Applications folder is already not going to be copied. Making matters potentially worse, though, suppose you next choose to include just one application. If we didn't clear the "Exclude /Applications" rule, there would be a conflict between "Exclude /Applications" and "Include /Applications/foo.app". To avoid these sorts of negative interactions as you start to define new Include rules, CCC removes the extraneous Exclude rules.

Calculating disk usage and "Amount to copy"

You can right-click on any folder and choose Refresh size to have CCC enumerate the contents of that folder and evaluate the task filter against its contents. CCC will report the total size of the folder on the source and the amount of data included to be copied. You can also click on the Calculate Sizes button in the toolbar to enumerate the contents of the entire source. This could take a while, especially for network volumes, so consider refreshing the disk usage of individual folders instead. If CCC is in the midst of enumerating a folder, you can right-click on that folder to stop enumeration, or click again on the Calculate Sizes button to stop the calculation.

Source and destination options

Finder's Trash is excluded by default

By default, CCC won't copy the contents of the Finder Trash because, well, it's Trash. If you want CCC to copy your Trash, click the Task Filter button, then uncheck the Don't copy Finder's Trash box in the Task Filter window sidebar to remove the exclusion. See this section of CCC's documentation to learn more about the idiosyncrasies of the Finder Trash mechanism and how it relates to backing up and restoring the content of the Trash.

Excluded files are not deleted from the destination

When you exclude an item from the CCC task, this tells CCC, "Do not copy that item". That does not, however, indicate that CCC should delete that item from the destination, e.g. if it had been copied there by a previous task. In fact, excluding an item from the task implicitly protects that item on the destination. If you have items on the destination that are now excluded from a task that you no longer want to retain on the destination, you can simply remove them from the destination by dragging them to the Trash. If you would like CCC to facilitate that cleanup, check the Remove excluded files checkbox in the sidebar.

The Remove excluded files option is ignored if your task is configured with the Don't delete anything SafetyNet setting. This setting also will not override CCC's explicit protections placed on the _CCC SafetyNet folder, so when this option is used in conjunction with CCC's "SafetyNet On" setting, items will be moved to the SafetyNet folder rather than deleted immediately. Likewise, the Protect root-level items setting overrides the Remove excluded files setting for root-level items.

When using the Include default filter behavior, the Remove excluded files option will only remove items that you have explicitly excluded via a custom filter. Items that are implicitly excluded (i.e. because you did not specifically include them using a conventional inclusion rule) will not be deleted from the destination.

We strongly recommend that you enable CCC's SafetyNet feature when using this setting until you are familiar with its behavior. Click on the Destination selector and choose SafetyNet On to enable SafetyNet.

The Protect root level items setting is described in more detail in the Advanced Settings article.

Respect macOS exclusions

Apple offers a method to third-party applications for flagging specific files to be excluded from Time Machine backups. When backing up to a locally-attached volume, CCC ignores these exclusion flags by default. You can check the Respect macOS exclusions checkbox in the sidebar to change that behavior. Note that CCC automatically enables this option when backing up a locally-attached source to a network volume destination to reduce the amount of unnecessary content being evaluated in NAS backup tasks.

CCC will show these excluded items in the Task Filter window when the Respect macOS exclusions setting is enabled. If you would like to get a complete list of files flagged in this manner, though, you can paste the following into the Terminal application (replace "/Users/yourname" with any folder you want to search within):

find /Users/yourname -xattrname "com.apple.metadata:com_apple_backup_excludeItem"

Custom Filters

If the files you want to match are scattered across your filesystem, it may be tedious to manually locate each of them and create conventional rules (i.e. check or uncheck the item in the file list). To address this, CCC offers custom filter options in which you define a filter rule using an expression. Click the Custom Filters button in the toolbar to reveal the custom filters table.

To add a custom filter rule, click the + button in the custom rules table header, or drag a file or folder from the file list into the custom filters table to add that item as a template. To reorder custom filters, simply drag and drop the items in the custom filters table. Custom filter rules will be evaluated by the task filter before conventional filter rules.

Anchored path filter

An anchored path filter defines a rule using an absolute path relative to the root of the source. /Library/Caches, for example, is an anchored path filter because it starts with a "/". This filter would match /Library/Caches, but would not match /Users/someuser/Library/Caches. You can also include wildcards in the expression, e.g. /Users/*/Library/Caches would match the Library/Caches folder in each user home folder.

Subpath filter

A subpath filter defines a rule using a partial path or filename that does not start with "/". Continuing the example above, Library/Caches would match /Library/Caches and /Users/someuser/Library/Caches. Wildcards are accepted in the expression; to match a particular file type, use an expression like *.mov to match all .mov files.

Wildcard characters

Wildcard characters can be added to an expression to match a wider range of files and folders. * will match one or more characters in any single file or folder name, e.g. *.mov will match all movie files.

/**/ will match one or more path components, e.g. /Users/**/*.jpg will match any JPEG photos in any user home folders, but won't match JPEG photos elsewhere, e.g. those in /Library/Desktop Pictures. You would also use the ** wildcard when defining an inclusion rule that should copy all items within a particular folder and its subfolders. For example, /Users/yourname/Documents would include only that folder itself, not any of its contents. /Users/yourname/Documents/** would include the Documents folder, all of its contents, and the contents of every subfolder within it.

If you specify additional path components after a ** wildcard, then that wildcard is only applicable up to a match against the path component that follows the wildcard. For example, the exclusion rule /Data/**/Marine/Invertebrates would exclude /Data/2018/Marine/Invertebrates, but it would not exclude /Data/2018/Marine/Benthic/Marine/Invertebrates. In the latter case, **/Marine matches 2018/Marine, but then the the next path component fails to match (and we are deliberately choosing to not allow the ** wildcard to match 2018/Marine/Benthic in this case).

? can be used to match any single character, e.g. *.mp? will match both .mp3 and .mp4 files. Use the ? wildcard sparingly, it will greatly increase the amount of time required to evaluate the task filter.

Excluding items that exist within a bundle file

CCC's Task filter does not expose the contents of bundle files (e.g. application files, Photos libraries) because bundle files should generally be kept whole, otherwise they may not function correctly when restored. If you have a specific reason to exclude some content from a bundle (e.g. cache files in a Final Cut Pro media bundle), you can do so with a custom exclusion rule. To make the rule apply to bundle components, click on the popup menu adjacent to the filter rule expression and toggle the Descend into bundles setting.

task filter window

Expert settings

Custom filter rules are usually applied to include or exclude an item. Exclusions, however, are actually composed of two behaviors: a matching item on the source will not be copied (Hide the item from the copier), and a matching item on the destination will be protected (Protect the item from the copier). Likewise, Inclusions indicate that a matching item on the source will be copied (Show the item to the copier) and a matching item on the destination may be deleted (Risk the item). Occasionally it's helpful to define a rule that affects only matching items on the source or only on matching items on the destination. For example, if you have a folder named "Archives" on the destination that does not exist on the source, that item won't appear in the source list so it cannot be excluded (and thus protected) in the conventional manner. You could add an /Archives Protect rule to explicitly protect that item on the destination.

Including folders and their content with the 'Include' filter behavior and custom rules

Including a folder or a bundle file and its contents via a custom rule requires a non-intuitive expression, because the filter rule must match multiple path components. To include a folder and all of its contents, add ** to the end of the filter expression. For example, to include the Photos Library from your home directory, the following expression would apply as an inclusion rule:

/Users/johnny/Pictures/Photos Library.photolibrary**

Exporting and Importing filters

A whole task filter can be imported or exported via the gear menu. When importing a filter, the current filter will be replaced with the filter you're importing. CCC will automatically purge conventional rules from the filter if they are not applicable to the currently-selected source. For example, if you had excluded /Applications in the filter, but /Applications does not exist on the current source, that rule will be removed from the filter to avoid unexpected results should an /Applications folder ever be added to the source. This purging is not applicable to custom filter rules.

You can also export individual or groups of custom filter rules. Select the rule(s), then simply drag the items onto your Desktop. To import custom rules from a file exported in this manner, simply drag the file into the custom filter rules table.

Items automatically excluded

CCC excludes some items from the backup task by default. A complete list of exclusions along with an explanation for the exclusion is available in this section of the documentation. If you would like to visualize the items that are automatically excluded, hold down the Option key while clicking on the Task Filter button to open the Task Filters window.

The CCC SafetyNet folder, "_CCC SafetyNet" is excluded by a global filter. See the Frequently asked questions about the CCC SafetyNet section of the documentation to learn how to restore items from that folder.

Additionally, CCC will exclude and protect system folders if you select the startup disk or a non-HFS+/APFS formatted volume as the destination. CCC will also exclude system files if you select a destination volume that is in the same APFS container as the current startup disk (because System Integrity Protection errantly prevents CCC from setting special flags on system files when copying files to another volume in the startup disk's container). If you would like to restore a specific item, such as the contents of /Library/Application Support, this protection can be avoided by choosing a specific folder at the source and destination via the Choose a folder options in the Source and Destination selectors. With great power comes great responsibility — take care to avoid overwriting your system files.

Related documentation

Disabling the Task Filter

If you would like to disable the task filter without discarding all of your exclusions, click the Disable Task Filter button in the toolbar. This will close the Task Filter window (saving any changes that were made to the filter), but then any user-defined inclusion or exclusion rules will be ignored for subsequent tasks. To re-enable the Task Filter, simply click the Task Filter button at the bottom of the window, then click the Done button. You'll know that your task filter is active if the icon of the Task Filter button at the bottom of the window is red.

Why is the "Task Filter" button sometimes disabled?

The Task Filter window dynamically evaluates the effect of your task filter, which requires that the source is available while the Task Filter window is open. The Task Filter button will be disabled if the source volume is not mounted, or (if applicable) if the selected source folder is missing. Additionally, the Task Filter button will be disabled if you have configured the task using the Legacy Bootable Copy Assistant; in that case, a filter cannot be applied, so the Task Filter is not applicable.