I have a script where I exclude certain files from the Time Machine backup via xattr -w "com.apple.metadata:com_apple_backup_excludeItem com.apple.backupd"
. This works fine.
After reading the tmutil
manpage I decided to change that to tmutil addexclusion
. Less hardcoding –> better portability.
But somehow that command does not do what I want it to do:
- it doesn’t accept relative paths (as when you are cd’ing into a directory and run the command there on a file)
- even with absolute paths it fails if the target file has been created recently or is being opened by an app.
Any ideas?