Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'How to delete objects from Time Machine backups via Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to delete objects from Time Machine backups via Terminal
Authored by: porg on May 19, '10 11:20:01AM

Thanks that someone showed how to do this from within TimeMachine!
Meanwhile there is an official Apple Help article on the topic:
http://docs.info.apple.com/article.html?path=Mac/10.6/en/26863.html

As I don't know the structure of TimeMachine backups well enough -- is it really only plain filesystem based or some additional index/check files? -- I do not dare to delete items from it by other (external) methods, to afraid to corrupt the structure.

If someone nevertheless wants to use the Terminal to achieve this, use the instructions below, AT YOUR OWN RISK.

COMMAND:
rm /Volumes/YourTimeMachineVolume/Backups.backupdb/YourComputerName/*/path/to/object/

Explanation:
The asterisk "*" catches all possible folder-names, thus applies to all date-folders, which by the way use the format "YYYY-MM-DD-hhmmss".
"rm" deletes files only, and only if you have the permission to do so. Alternately you can use:
"rm -r" Delete files and folders, and only if you own them.
"sudo rm" Delete files only as the super user.
"sudo rm -r" Delete files and folders as the super user.

Be sure to escape every single whitespace in the filepath with a backslash! Surrounding your complete path with quotation marks will fail, as this will prevent shell globbing, meaning that the asterisk character in your filepath is considered literally and not treated as a wildcard character.

Example for a path with correctly escaped whitespaces:
sudo rm -r /Volumes/My\ Time\ Machine/Backups.backupdb/My\ Computer/*/path/to/dir/

REAL WORLD EXAMPLE:
rm -r /Volumes/sno-tm/Backups.backupdb/snmbp/*/sno/Users/sn/test/1/

My computer is called "snmbp", "sn" being my name initials, "mbp" abbreviating "Mac Book Pro".
My system drive is "sno".
My time machine backup is on a volume named "sno-tm".
In my home directory "/Users/sn/" I want to delete the folder "/test/1/" and all its contents, hence the "-r" (recursive) option.
I am using "rm -r" as I only want to delete files/folders, for which I have the permissions, and that is to be expected within my home directory.



[ Reply to This | # ]