SCP (Secure Copy) is an excellent method of copying folders across different servers; it makes server moves a breeze.

To use SCP, log into the server you want to copy the files TO, and move to the folder in which you’d like the files and foldersĀ  to appear.

The SCP command itself is as follows;

scp -r username@servername:sourcefolder targetfolder

In this example, we will copy the folder public_html and its contents from a remote server to the server we are logged into.

Details you will need;

Remote Username: arthur
Remote Servername: (you can use IP address or the domain name)
Remote Folder: /var/www/vhosts/testsite/httpdocs

On your local server, log in and move to the folder you wish to copy the files into, and issue the following command;

scp -r -c blowfish [email protected]:/var/www/vhosts/testsite/httpdocs/* /home/newtestsite/public_html

This will put the contents of httpdocs and all it’s subfolders into the folder public_html on the new server. Permissions on the new files and folders will be inherited from the user you have logged into the local machine as.