Skip to content

Instantly share code, notes, and snippets.

@gangelo
Created March 2, 2020 15:28
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 gangelo/f9e03e7d6526954b71e1bb49156b314d to your computer and use it in GitHub Desktop.
Save gangelo/f9e03e7d6526954b71e1bb49156b314d to your computer and use it in GitHub Desktop.
Bash script to delete local Time Machine snapshots
for d in $( tmutil listlocalsnapshots / )
do
if [[ $d =~ ^.+([0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6})$ ]]; then
date=${BASH_REMATCH[1]}
echo "Running tmutil deletelocalsnapshots $date..."
( tmutil deletelocalsnapshots $date )
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment