SFTP in Java

For a copy of the sample project please
click here
to download and install the product evaluation.
Introduction
This demonstrates how Java clients can connect to SFTP servers to transfer files.
Detail
SFTP and Java
SFTP is a secure protocol for transferring files. For
Java clients to communicate to SFTP servers, the client side of
the SFTP protocol must be implemented in Java.
It is not realistic for most applications to directly implement the SFTP
protocol. Instead, it is best to acquire an implementation that is well
tested and feature rich - for example, edtFTPj/PRO. The following example
demonstrates how a client using edtFTPj/PRO can connect to an
FTP server and list the current directory on the server. It downloads
every file in the directory.
SecureFileTransferClient client = new SecureFileTransferClient();
// set params
client.setRemoteHost(host);
client.setUserName(username);
client.setPassword(password);
client.setProtocol(Protocol.SFTP);
client.connect();
for (int i = 0; i < files.length; i++) {
System.out.println(files[i].toString());
client.downloadFile(files[i].getName(), files[i].getName());
}
client.disconnect();
Visit
Enterprise Distributed Technologies
for more information and more samples.