How does one use the nonstandard sun.net.ftp.FtpClient to get a list of files from a remote site directory?

Tim Rohaly

I strongly recommend that you don't rely on this class, because it is part of Sun's implementation, therefore is vendor-specific and subject to change at any moment. Stick with either the documented classes that are part of the Java programming environment or write your own FTP client class as part of your application.

But if you really feel you must use sun.net.ftp.FtpClient, the list() method of FtpClient returns an InputStream which you can use to read the names of the files in the directory, then loop over these names and fetch each one as shown in the FAQ at http://www.jguru.com/jguru/faq/view.jsp?EID=17357.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact