Download and Upload Ghost Images with SCP
You can download and upload your Ghost CMS images folder using the command line. You need command-line access to your DigitalOcean Ghost droplet from your computer.
I will use the SCP command-line tool. SCP stands for secure copy. It transfers files securely between a remote server and your computer. In our case, it will copy the images from the Ghost server to the local computer and vice versa.
Zip Images Folder
First, log in to your Ghost server. Then zip the images folder.
Login to your DigitalOcean remote server with your droplet IP address.
Replace 207.154.195.220 with your IP.
ssh root@207.154.195.220
Go to the Ghost installation content path.
cd /var/www/ghost/content/
Zip the images folder using the zip command.
zip -r images.zip images
You may need to install the zip command tool if it is unavailable on your server.
If zip is missing, your shell may show an install command. Use your server’s package manager to install it.
Now, you have the images.zip file ready for download.
Return to your computer’s shell before running SCP:
exit
The commands below run on your computer, not inside the SSH session. Replace the example IP address with your server’s address. Replace /Users/ahmadajmi/Desktop with your own local folder. The upload example can use a different server if you are moving images between sites.
Working with SCP
For a download, SCP needs two paths. The remote file path comes first. The local folder comes second.
scp REMOTE_PATH LOCAL_PATH
In our case, the remote path will be something like this:
root@207.154.195.220:/var/www/ghost/content/images.zip
And the local path, for example, will be on my desktop.
/Users/ahmadajmi/Desktop
Download Images
Combine those paths to download the zipped images folder:
scp root@207.154.195.220:/var/www/ghost/content/images.zip /Users/ahmadajmi/Desktop
Upload Images
To upload images from your computer to the server, reverse the paths. Put the local path first and the remote path last.
The upload example uses a second server, 159.65.227.236. Replace it with the destination server’s IP address. If you are restoring to the same server, use its address instead. I assume images.zip is on the desktop. The upload command is:
scp /Users/ahmadajmi/Desktop/images.zip root@159.65.227.236:/var/www/ghost/content/
Unzip Images
After uploading images.zip, log in to the destination server. Use the same destination IP address as in your upload command. Then open the Ghost content folder:
ssh root@159.65.227.236
cd /var/www/ghost/content/
The following command extracts the archive. The -o option overwrites files with matching names without asking. Keep a separate backup of the destination images before using it. This command does not remove destination images that are absent from the archive.
unzip -o images.zip
That’s all I wanted to share today, and I hope you find this post helpful.
More from the Blog
Latest Ghost Themes
Arish
For visual magazines that lead with photography, film, and selected stories.
Siwa
A personal publication that introduces the writer before inviting readers into the stories.
Hanoi
An image-led magazine for creative stories, rich navigation, and long-form reading.
Taba
A newsroom front page for coverage across topics, video, and story formats.
Marsa
A flexible publication homepage for featured stories, topics, and newsletters.
Hakone
For writers who want readers to browse complete posts on the homepage.