There is an extended attribute that can be set on a file system object (e.g., file or directory) which is supposed to tell Time Machine not to back up that object. The best way to set or clear that extended attribute is with tmutil addexclusion
and tmutil removeexclusion
commands. Enter man tmutil
in Terminal to read the details about this.
Set an exclusion for "myfile": tmutil addexclusion myfile
...
Good hint, tbh myself never consulted description of command's verb addexclusion as I expected it be doing identical stuff as Options... in Time Machine Preferences (System Preferences GUI). There is the plist file in
/Library/Preferences
folder which handles fields ExcludeByPath and IncludeByPath. Had always this mechanism in front of my eyes.
Do you mean
tmutil addexclusion -p myfile
be conducting what Time Machine Preferences options utilize while same verb free of flags conducts setting of extended attribute file system level?
Regarding Time Machine plist file and
ExcludeByPath
and
IncludeByPath
i wonder if
* these support wildcard characters as well, and
* one can use IncludeByPath to set exclusion from ExcludeByPath - let's consider some folder sub-tree with its root folder be present in ExcludeByPath setting but certain path deep in that sub-tree be present in IncludeByPath?