find $(pwd) -type d -name <NAME> -maxdepth 3 -exec tmutil addexclusion {} \;
We can automate finding and adding exclusions by running tm_exclude.sh
script as a cronjob:
-
Save
tm_exclude.sh
as executablenano ~/tm_exclude.sh # paste file contents below, save, and exit chmod +x ~/tm_exclude.sh
-
Open crontab:
crontab -e
-
Schedule tm_exclude.sh:
# crawl files to add time machine exclusions @1am 0 1 * * * /bin/bash ~/tm_exclude.sh
-
Save and exit crontab (
:wq
if vi;ctrl-o ctrl-x
if nano)
sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"
tmutil removeexclusion /path/to/directory