Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm on Lion and until ten minutes ago I didn't know that the nifty new tmutil existed. But now I'm a little uncertain with all its options and sub-commands which to use to try and figure out what went wrong and how to fix it.

A program ran amuck and started deleting files from ~. It made only a little progress before I stopped it, but doubtless I lost some files. I just can't tell out of a drive with hundreds of thousands of files, which ones went away. I know there were some configuration files (for example .bash_profile) because those were right there in that folder, but doubtless it went off in some depth first rampage so no telling what got deleted and from where.

I can't just do a restore of /Users/John (the Mac OS prevents it), I can't restore all the files inside of /Users/John using the GUI (the Finder ignores all the .something files and folders, some of which I know were deleted), so my current hope is to figure out from the command line exactly which files got the axe and somehow restore only those from my Time Machine backup.

In other words... help.

share|improve this question
add comment

2 Answers

Run

tmutil listbackups

to get the list of snapshots available. Pick the one before the problem occured and run

tmutil compare YOUR-SNAPSHOT-HERE | cut -c33- | grep /Users/YOUR-USERNAME

to get a list of differences between then and now. If you leave out the cut part you may also get some indication concerning the actual difference (but it's more difficult to use the result afterwards).

share|improve this answer
add comment

If I were in this situation, I wouldn't use tmutil; I'd use something like

    cp -Rnp "/Volumes/Time Machine/Latest/Macintosh HD/Users/John/.*" ~

to restore any dot-files or directories, and the GUI to restore anything else.

share|improve this answer
    
OK, I tried this. It went... poorly... I ended up with large numbers of files now apparently having the wrong permissions on them and I have no idea how. Especially when the 'p' flag was on the copy. Most of my software won't run and any attempt to change the permissions to give more and more permissions to allow software to run seems to make things worse. I'm now at the state of needing to get Lion to make a full disk recovery from my Time Machine backups. So, in general, I don't think I'd suggest to anyone else that they try this. –  John Munsch Sep 11 '11 at 14:49
    
I'm really sorry it went badly. It worked well when I tried it on my system; I didn't encounter any permission problems. Repair permissions might be helpful here. –  Daniel Lawson Sep 11 '11 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.