Transfer file from SFTP server to the local system using Java
Question
I am using the JSch library.
I need three methods:
void delete()
--- to delete the file with the given namevoid copy()
--- to copy the file with the given name into the local systemlist copyndelete()
--- to copy the file and to delete the file in the remote system ... and also return the name of the file deleted into the list.
How could I do this?
Solution
You could try using Apache FTPSClient.
OTHER TIPS
Try using Jcraft . Its an Open source Project
The JSch library contains the ChannelSftp class. This class has (between others) also methods to
- copy remote files to local ones (all the
get
methods) - delete remote files (the
rm
method, orrmdir
to delete empty directories) - list remote files (
ls
)
All your requirements can be fulfilled from combinations of these methods.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow