Skip to content

Instantly share code, notes, and snippets.

@darren
Created March 6, 2019 13:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darren/b708253bb1b0ab603fa00ec942e641b1 to your computer and use it in GitHub Desktop.
Save darren/b708253bb1b0ab603fa00ec942e641b1 to your computer and use it in GitHub Desktop.
function tmc() {
before=$(df -hl / |awk '{print $3}' |tail -n1)
count=0
for snapshot in $(tmutil listlocalsnapshots /|awk -F. '{print $4}');do
let 'count++'
echo "delete snapshot $snapshot"
tmutil deletelocalsnapshots $snapshot;
done
after=$(df -hl / |awk '{print $3}' |tail -n1)
if [[ $count -ne 0 ]]; then
echo "Total $count snapshot(s) deleted, Size change: $before ===> $after"
else
echo "No snapshot deleted"
fi
}
function tml() {
tmutil listlocalsnapshots /|awk -F. '{print $4}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment