I have been trying to copy few selected files (after performing few checks), in a remote server to the same remote server using:
File localFile = new File(sr
A core SFTP protocol does not support duplicating a remote file.
There's draft of copy-file extension to the protocol, but that's supported by only few SFTP servers (ProFTPD/mod_sftp and Bitvise SFTP server for example).
The JSch library does not support the copy-file
extension either.
Alternatives:
cp
command (or equivalent command for your server's OS).See also How can I copy/duplicate a file to another directory using SFTP?