September 29, 2009

Java FTP Example

« Java Runtime Inspection - Pax Reflector | Main | Hibernate Spring Tutorial »

The Apache Commons Net project offers you an API for FTP access. Based on this API you can download, upload or traverse the directory tree of your FTP account.

The following steps are required to use the FTP API:

FTPClient f = new FTPClient();
f.login("username", "password");
FTPFile[] files = f.listFiles("/");
for (FTPFile file:files) {
  System.out.println("" + file.getName());
Rafael Sobek

Technorati Tags:

Posted by rafael.sobek at 6:37 AM in Java


[Trackback URL for this entry]

Your comment:

(not displayed)

Live Comment Preview: