copying files between servers using command line

EnWorldly

New Member
Joined
Oct 12, 2018
Messages
4
Reaction score
4
Credits
0
hi guys,
I've got a list of files in one server location that I want to copy over to a location on a completely different server. What is the best (and most simple if possible - I'm a bit of a newbie) way to do this?

The files are all nested inside various subfolders, but I can generate a list of them with their full directory paths.

thanks in advance for your help
 


Did you try

1. scp?
2. ssh in order to wget?


Nup. Didn't really try anything yet! I do ssh into both of the servers (the source and the target), if that helps? Would you then recommend wget? Should I do that from the source location (where I am copying the files from), or the target location (where I am copying the file to)? thanks!
 
wget didn't work, because I'm sftp 'ing into the source location, and wget returned: "Unsupported scheme 'sftp'. "
 
Rsync?

(Wizard appears in a puff of smoke)

Welcome to linux.org @EnWorldly :)

I don't use it myself, but a lot of Sysadmins do!

Google up

"linux rsync" and see what you think.

Cheers and

Avagudweegend

Chris Turner
wizardfromoz
 
Yep, rsync is your best bet here..

Let's say you want to copy the files from server1:/path/to/files/ to server2:/other/path/ you would simply do:
From server1:
Code:
 rsync -avz --progress /path/to/files server2:/other/path/
From server2:
Code:
 rsync -avz --progress server1:/path/to/files/ /other/path/
 
Yep, rsync is your best bet here..

Let's say you want to copy the files from server1:/path/to/files/ to server2:/other/path/ you would simply do:
From server1:
Code:
 rsync -avz --progress /path/to/files server2:/other/path/
From server2:
Code:
 rsync -avz --progress server1:/path/to/files/ /other/path/


Thanks Rob and WizardFromOz (yes I did avagudweegend).

my question now is this: the files are not all in one location on the source. (They are all going to the same location at the target). So, can I put in multiple filepaths for the source files? E.g. a distinct path for each file? Like, a list of paths, as a way of defining the list of files that I want to copy across?

cheers, Nick
 
G'day Nick :)

I will likely bail at this point, as this is beyond my paygrade :(. I use rsync on a daily basis, but indirectly, as it is the underlying engine for Tony George's Timeshift which I use daily.

I knew of rsync's use for sysadmins in deploying packages and files remotely only through reading, but have not used it as such per se.

@Rob , @JasKinasis and perhaps new Member @HostechSupport may be of further assistance.

I mention Jas because as well as working in the industry, he is a "wizard" on scripting, and it sounds to me that if rsync cannot cope with the disparate paths of its own accord, then a script might be in order.

That is just a guess.

Good luck, I'll sit back and watch and learn :rolleyes:

Wizard
 


Top