AppleScript to selectively prune Time Machine backups

Hi,
I tried to search the net for a simple utility that would allow me to delete some backups from a NAS. Ended up with doing it myself :slight_smile:

set mountPoints to do shell script "tmutil destinationinfo | grep 'Mount Point' | sed 's/Mount Point   : //' | sed 's/ /\\\\ /g'" with administrator privileges
set mountPoint to choose from list (paragraphs of mountPoints) with prompt "Select mount point"
if mountPoint is false then return

set backupsList to do shell script "tmutil listbackups -m -t -d " & mountPoint with administrator privileges
set backupsChoice to choose from list (paragraphs of backupsList) with prompt "Select backups to delete:" with multiple selections allowed
if backupsChoice is false then return

repeat with i from 1 to number of items in backupsChoice
	set this_item to item i of backupsChoice
	do shell script "tmutil delete  -d " & mountPoint & " -t " & this_item with administrator privileges
end repeat
1 Like