'How do I copy files stored in a remote SFTP server to another folder in the same remote server using Java?

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(srcPath);
sftpChannel.put(localFile.getAbsolutePath(),localFile.getName());

I have even tried to copy those selected files to my local machine using the get() method.

Can somebody help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source