How do I copy files from my droplet to my PC for backup

Posted November 27, 2019 6.7k views
Getting StartedBackupsDeployment

I had someone build and deploy a project inside of a droplet. I realise that I do not have a backup of the files.

How can I take a copy of the files from the droplet? I have not worked with droplets before, so I am unaware of the process

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hello, @lindymills

It’s pretty easy. You can use scp or rsync in order to do that.

To transfer a file from a remote machine to your local machine, run the following command:

scp -r username@ /local/directory

you need to change the username and the IP address. To scp to a different port use:

scp -P 2222 -r username@ /local/directory

Like scp, rsync is used to copy files either to or from a remote host, or locally on the current host.

rsync -avz user@ /local/directory

To use rsync on different port:

rsync -avz -e "ssh -p $portNumber" user@ /local/path/

Let me know if you have any questions.