Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Instruct Time Machine to exclude some development directories
#!/usr/bin/env bash
# This simple bash script is aimed at excluding some development specific directories.
#
# In this configuration it will instruct Time Machine to exclude directories named:
# - env
# - node_modules
# - vendor
# - venv
#
# Feel free to update this array to your own needs.
EXCLUDED_DIRECTORIES=( "env" "node_modules" "vendor" "venv" )
WORK_DIR=$(dirname "${BASH_SOURCE[0]}")
WORK_DIR=$(realpath "${WORK_DIR}")
for EXCLUDED_DIRECTORY in "${EXCLUDED_DIRECTORIES[@]}"; do
find ${WORK_DIR} -maxdepth 2 -type d -name ${EXCLUDED_DIRECTORY} -prune -exec tmutil addexclusion {} \;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.