Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Roarcannotprogramming/91828acebc119e9927082918db3fe8a8 to your computer and use it in GitHub Desktop.
Save Roarcannotprogramming/91828acebc119e9927082918db3fe8a8 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