Mac – Time Machine: exclude folders with same name, now AND in the future

time-machine

I want to exclude backup of proxy media in Final Cut Pro. This media is located in:

~/Movies/Final Cut Events/[Event Folder]/Transcoded Media/Proxy Media

Problem is, when I create a new [Event Folder] it creates a new directory named "Proxy Media" which has to be manually omitted from Time Machine each time. I'd like to automate this process.

I've looked at tmutil in the command line, but I don't think that will do it.

Best Answer

You could save a property list like this as ~/Library/LaunchAgents/excludefinalcut.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>EnableGlobbing</key>
  <true/> <!-- enable wildcard and tilde expansion for ProgramArguments -->
  <key>Label</key>
  <string>excludefinalcut</string>
  <key>ProgramArguments</key>
  <array>
    <string>tmutil</string>
    <string>addexclusion</string>
    <string>~/Movies/Final Cut Events/*/Transcoded Media/Proxy Media</string>
  </array>
  <key>WatchPaths</key>
  <array>
    <string>~/Movies/Final Cut Events</string>
  </array>
</dict>
</plist>

Then load the plist by running launchctl load ~/Library/LaunchAgents/excludefinalcut.plist.

tmutil addexclusion gives files a com.apple.metadata:com_apple_backup_excludeItem extended attribute. sudo tmutil addexclusion -p would add files to the SkipPaths dictionary in /Library/Preferences/com.apple.TimeMachine.plist that is also modified by System Preferences.