6

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.

  • 2
    If you want to do this often I think you are using the wrong tool try Carbon Copy Cloner or Superduper which are designed to just have one copy a – user151019 Apr 22 '17 at 9:52
  • 1
    But both cost less(and not a massive amount) than the problems of a bad backup or the time you have spent doing this - but for free look at rsync – user151019 Apr 22 '17 at 15:45
5
#!/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.

  • 1
    @Ivanov This may very well have changed with Mojave, even though not being able to delete a backup using tmutil makes the option kind of pointless. Can you please ask a new question using the "Ask Question" link above, explain what happens in Mojave, and ask for answers? Add a link to the Q&A above for reference. – nohillside Nov 11 '18 at 10:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .