Last active
September 19, 2024 14:18
-
-
Save techouse/f2f25b38eb6a3d6a6027b3f21a1206af to your computer and use it in GitHub Desktop.
Instruct Time Machine to exclude some development directories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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