Advertisements

How to migrate website files using SCP

If you’re a web developer looking for a quick way to move files from one *nix server to another, SCP is your answer.

SCP quickly moves files from one server to another using an SSH tunnel.

Simply log on to your existing host and use the following command as example syntax:

scp -r * login@domain:/target/folder/to/webroot/html/

login: your SSH login at the new host
domain: the hostname of your new host
/target/folder/to/webroot/html: the path to where you want your files stored

You’ll be prompted for your password after you hit enter.
This should transfer all of the files directly to your new host, but will NOT transfer hidden (dot) files.

If you use a dot ( . ) instead of the star ( * ), it will transfer the current directory WITH hidden files:

scp -r . login@domain:/target/folder/to/webroot/html/

Comments are welcome, as always.

Advertisements

, ,