Java FTP multi file transfer
Hello Friends,
I heard that Java FTP multi file transfer will be very much effective and will run at high speed, Can anyone provide me the Java coding for FTP multi file transfer.
Please Help,
Angela D Sloan
Hello Friends,
I heard that Java FTP multi file transfer will be very much effective and will run at high speed, Can anyone provide me the Java coding for FTP multi file transfer.
Please Help,
Angela D Sloan
There are four options to transfer FTP files in java, and one of them gives the opportunity of transferring multi files, named, Jakarta Net Classes. It is well tested and free to use, is more feature-rich than other classes, so Jakarta Commons is a good bet. The code for using this is:
Â
FTPClient ftp = new FTPClient();
ftp.connect("ftp.example.com");
ftp.login("admin", "secret");
ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
Â
for(File file : files) {
   InputStream in = new FileInputStream(file);
   ftp.storeFile(file.getName(), in);
   in.close();
}
Â
ftp.disconnect();
Â
Â