Skip to content

Instantly share code, notes, and snippets.

@breun
Last active August 29, 2015 14:05
Show Gist options
  • Save breun/2c3e048e5289ec7b27c9 to your computer and use it in GitHub Desktop.
Save breun/2c3e048e5289ec7b27c9 to your computer and use it in GitHub Desktop.
Exclude Maven target directories from Time Machine backup
# Exclude all paths for directories named 'target' in the ~/Projects directory (which I use for my Maven projects)
# Sticky excludes (without -p and sudo) are not that useful, because 'mvn clean' removes the target directory
find ~/Projects -type d -name target | xargs sudo tmutil addexclusion -p
# List all items excluded by path
plutil -convert xml1 -o - /Library/Preferences/com.apple.TimeMachine.plist | xmllint -xpath /plist/dict/array[2] -
# List all items with sticky excludes
mdfind "com_apple_backup_excludeItem = com.apple.backupd"
@breun
Copy link
Author

breun commented Aug 8, 2014

There's also a Maven plugin which excludes the target directory from Time Machine back-up, but currently it's giving me an error: http://snippets.syabru.ch/maven-timemachine-plugin/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment