Terminal – Avoid Custom Access Permissions When Copying from Time Machine

terminaltime-machine

I have recently done a clean install of El Capitan, having backed up files on Time Machine. However, there is something wrong with the time machine backup: when I enter time machine it won't list the old backup, only the one that I did after the clean install. (I think there's a problem with the drive I'm using.) However, the files are all there, so I can copy them to my hard drive using the cp command in the terminal.

However, if I try

cp -r /Volumes/TimeMachine/…/Documents/* Documents

all the files appear with today's time stamp, which is not very helpful.

If on the other hand I enter

cp -pr /Volumes/TimeMachine/…/Documents/* Documents

I get the correct time stamps, but I also get the level of protection that Time Machine has – which is to say I can't edit anything I copied!

Does anyone know whether there's a way to preserve time stamps, but not this extreme level of protection?

Thanks

Best Answer

A way to copy files which can deal with interruptions etc, that is it will not copy something that has not changed is to use rsync

OS X comes with an old version and it is best to get a newer one from macports, homebrew etc. This can copy ACLs and there is a bug in the OS X one (that is in one of my other answers her or SU or SO)

The simple copy is (the directory Documents to the current directory)

rsync -rtlA /Volumes/TimeMachine/.../Documents .

-a does several other parameters (-rlptgoD ) -A copies the ACLs -r recurses into directories, -t preservers modification times, -l copies symlinks as simlinks