How to delete (tmutil delete) all old backups from TimeMachine - keep only current full backup How to delete (with CLI tmutil delete) all old backups from TimeMachine. I wish to keep only current backup.

I wish to put that into crontab.

Found How to Delete Old Backups from Time Machine on Mac

sudo tmutil delete /Volumes/Time Machine Backups/Backups.backupdb/MacBook\ Pro/2015-07-13-150021/


I don't like to specify Timestamps. I wish to have only one current full backup. This means remove deleted files and versions from backup disk.
#!/bin/bash
latest=$(sudo tmutil latestbackup)
sudo tmutil listbackups | while read backup; do
    if [[ "$backup" != "$latest" ]]; then
        echo sudo tmutil delete "$backup"
    fi
done


Remove the echo once you are sure that the output is correct.