My name is Stefan Ashwell and when I'm not coding personal projects or painting miniatures, I'm a Software Engineer at Holmes Media in Market Harborough.

This blog is a place for me to write about things that require that little bit extra to solve. We all have gaps in our knowledge and every now and then I need to reach out on search engines or blogs to find an answer. Often, these answers come from multiple sources. This blog serves as a personal resource, but if it's helpful for me I'm sure it'll help others too!

Transfer files between two servers with scp

Posted on 26 June 2015

When moving a website to a new server, this script comes in handy allowing you to transfer the files directly from one server to the other. This means you don’t have to download to your desktop or re-upload etc. Additionally, the data centres you host with will most likely have a better internet connection than you do, so they transfer quicker too.

Note: The command below will transfer a tar archive from one server to another, read this article if you need to know how to create the tar archive first.

scp file/to/transfer [email protected]:/path/to/destination

Run this while logged in to the original server, using the username and ip you use to ssh into the new server.