Skip to content

Instantly share code, notes, and snippets.

@toonetown
Created February 20, 2020 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toonetown/32c7ef439fc636056d4eeea20e882f32 to your computer and use it in GitHub Desktop.
Save toonetown/32c7ef439fc636056d4eeea20e882f32 to your computer and use it in GitHub Desktop.
A script which automatically will exclude build directories from time machine
#!/bin/bash
: ${BASEDIR="${HOME}/Documents/Programming"}
: ${MAXDEPTH=6}
find "${BASEDIR}" -maxdepth ${MAXDEPTH} -type f \( -name pom.xml -o -name build\.sh \) -print0 \
| while read -d $'\0' _f; do
find "$(dirname "${_f}")" -maxdepth 1 -type d \( -name target -o -name build \) -exec tmutil addexclusion {} \;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment