Pergunta

I used scp to copy file between servers without using 'preserve times' option and now want to restore original times of copy using source file times. Of course I can display these times, write it down and modify destination file. But I'm wondering if there is a posibility of using touch -r with reference file on remote server. Or if there is any other command/combination of commands which can grant me such goal.

Foi útil?

Solução

You could touch an intermediate file and use it to carry the information:

ssh user@hostname "touch file -r remote-file"

Then scp -p the new file back:

scp -p user@hostname:file local_destination

Then touch -r the file you copied in the first place.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top