Are time machine directory exclusions recursive?
Yes, directory exclusion are recursive. This means that if you exclude for example ~/MyDocuments/
then everything in that folder and beneath is excluded. That includes for example ~/MyDocuments/SubFolder/document.docx
.
However, there are some special cases. When you have a non hard-link, the link itself is excluded, but the link is not followed to exclude the objects linked to. This means that a symbolic link or firm link, like you have in your case, is excluded from the backup - but not what it links to.
In your case /usr/local
is not really a subfolder of /usr
, but rather a link. This is the reason you see that /usr/local
, which is really /System/Volumes/Data/usr/local
, is not excluded when you exclude /usr
.
Note that excluding a directory does not exclude the volumes mounted under that directory. For example sudo tmutil exclude -p /System
will only exclude directories in the volume /
(but not other volumes mounted to /System/Volume/
e.g. /System/Volume/Data/
).
According to the man page:
The third kind of exclusion is a volume exclusion. These track volumes based on file system UUID, which is persistent across volume name and mount path changes.
Therefore sudo tmutil exclude -v /
will exclude folders and volumes (including /System/Volume/Data/
).