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();