How to Secure copy (SCP) with file timestamp

The other day I need to migrate files over to my new NAS, to do this I had to SSH in to the box and run a SCP command to copy over files. But at the sametime I wanted to keep their timestamp. To do this you need to run the following command

First ssh into your box and go the fold where you want to copy files to then run this command:

$ scp -r [username]@[ip-address]:[path-of-files] .

if you would like to keep timestamp run this command. notice I added ‘p’ after the ‘-r’.

$ scp -rp [username]@[ip-address]:[path-of-files] .

‘-r’ is recursive ‘p’ is for preserve (file details).

Tags:

Comments are closed

Latest Comments