Is there a command to move a file from my droplet to local?

Posted February 15, 2020 1.9k views

I’ve been using GitHub to move files between my droplet and my computer, which works fine.

But I was wondering if there’s a way through command line to move files from the droplet to my local machine.

Thank you

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

Hi @jouo,

You can use either rsync or scp to move files from one place to another.

Let’s use scp for this example as it’s simpler(in this case). You’ll need to use it like so

scp root@YourDropletIp:/path/to/your/file/file.txt /local/path/where/it/should/be/saved

If you have any custom SSH port on your droplet, you can use it like so

scp -P 2222 root@YourDropletIp:/path/to/your/file/file.txt /local/path/where/it/should/be/saved

And if you wish to copy files recursively, you can do it by executing the command as

scp -r root@YourDropletIp:/path/to/your/file/file.txt /local/path/where/it/should/be/saved