Report this

What is the reason for this report?

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

Posted on February 15, 2020
jouo

By jouo

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.
0

Accepted 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

Regards, KDSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.