Ghost provides an easy way to back up the content of your website, from the Labs page you can choose export your content which will 'Download all of your posts and settings in a single, glorious JSON file'. However, the export doesn't include a vital part of your blog content, specifically any files that you've uploaded. Frustratingly there is also no straightforward way to download all those files that I'm aware of. If you have ssh access to the server hosting your Ghost blog however you can do this easily using scp.

The Secure Copy Protocol is a network protocol, based on the BSD RCP protocol, which supports file transfers between hosts on a network. What that translates to in practice is a simple way to do file transfers over ssh and since Windows now bundles  ssh like a real operating system you're pretty much guaranteed to have scp available whatever os you're currently using.

By default, Ghost stores images in the content/images folder of your installation organised into sub-folders by year and month. If, like me, you're hosting on a Digital Ocean Droplet then your images will be stored under /var/www/ghost/content/images/. So, to download all my images I simply create a local folder and scp all the files into that folder like this:

mkdir ghost-images
scp -r [email protected]:/var/www/ghost/content/images ghost-images
Create directory and download

Specifying the -r flag tells scp to run recursively so all sub-folders are also downloaded and, depending on how many images you have this might take a while.

I was doing this download so that I could migrate from one server to another, so the next step was to upload all those images. To do that you just have to reverse the order of arguments you pass to scp:

scp -r ghost-images [email protected]:/var/www/ghost/content/images 

Happy copying :)