Server to server file transfers

Server to server file transfers are relatively easy on a dedicated or virtual private server running Unix. I’ll quickly show you how to use the scp command which acts just about exactly the same as the cp command. It copies all files from a specified source path to a destination path on the remote server and uses via SSH.

Lets say that I wanted to transfer all the files and folders of a single domain on Plesk, inside the httpdocs folder to another Plesk server into the public html directory of another domain, I would first change directory to where the source files lie.

cd /var/www/vhosts/domain.com/httpdocs

Quickly check the current path that you are in.

pwd

Now execute the scp command together with the username of a user whom has shell access on the remote server. After the username, we append the path to which the source files will be copied to the destination server. You’ll also notice that I used -r which is the recursive option. It will recursively copy all files folders, subfolders, etc…

scp -r * root@domain.com:/var/www/vhosts/domain.com/httpdocs/

And that’s it! You’ll have all the specified source files copied from one server to another. I’m going to post another tutorial shortly on how to dump an entire MySQL database directly from one server into the database of another, remote server. Check the RSS feed if you are interested.

Comments

Leave a Reply