Can `tmutil restore` recursively override files?

1

I ran the following commands:

cd /Users/user/
mkdir back_me_up
touch back_me_up/touched_file
tmutil startbackup --block
rm back_me_up/touched_file
tmutil restore /Volumes/BackupParition/MyMac/Latest/MainPartition/Users/user/* /Users/user/

And got:

/Users/user/Desktop: File exists (error 17)
/Users/user/Documents: File exists (error 17)
/Users/user/Downloads: File exists (error 17)
/Users/user/Library: File exists (error 17)
/Users/user/Movies: File exists (error 17)
/Users/user/Music: File exists (error 17)
/Users/user/Pictures: File exists (error 17)
/Users/user/Public: File exists (error 17)
/Users/user/back_me_up: File exists (error 17)

So back_me_up/touched_file was not recovered.

Is there a way to recursively override existing files with the tmutil restore command?

EliadL

Posted 2017-02-15T10:23:57.743

Reputation: 113

Answers

2

Personally, I didn't find any way to make 'tmutil restore' automatically override files and directories. Looks like the answer is no.

However, you can easily script this behavior, using 'tmutil compare'. It outputs the differences between your current files and a specific backup in a nicely formatted, easily parsed format. You could do something like:

pathList = parseCompareResult('tmutil compare')
for path in pathList:
    rm -rf path
    tmutil restore path

fkorsa

Posted 2017-02-15T10:23:57.743

Reputation: 136