Home > Software design >  Is there any way to send files directly from remote A to remote B from local using JSCH?
Is there any way to send files directly from remote A to remote B from local using JSCH?

Time:11-11

I have read Send files from one remote server using JSch to another server using JSch too and the code seems very promising. But one downside it has is it uses local machine as buffer for transferring files. (So file flows like Remote A – Local – Remote B)

I want send any protocol(SSH maybe) to remote A and remote A send files to remote B directly (using SFTP). (desirable: Remote A – Remote B)

It doesn't have to use JSch specifically, but it is the only one seems workable I have found so far.

It can be done manually but all jobs must be done automatically.

Any single keyword or pseudo-code would be very thankful!

CodePudding user response:

There's no common API (maybe except for FTP FXP) for transferring files directly between two remote machines.

All you can do is to execute whatever commands you have available on one server that transfers files to/from the other. You didn't tell us anything about your servers. But most Linux/Windows servers would have some sftp/scp client available.


And btw OpenSSH scp has transfer between two remote machine built in. So you can execute it on the local machine. See How to transfer a file between two remote servers using scp from a third, local machine? But that's not really much help, as it basically does ssh to one server and executes scp there to transfer files to/from the order server. So it does what I've suggested you to do with JSch above.

  • Related