commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daerian <daer...@gmail.com>
Subject [Net] I'm having a problem using the listList files method in the FTPClient class
Date Sun, 15 May 2005 03:30:54 GMT
I'm using FTPClient class to write an FTP client. I've searched some 
examples on the internet of how to use the class methods. In the various 
examples I've found the listFiles method is always used in the same way, but 
when I try yo connect to an FTP server and use it I don't get any file. I've 
tried several FTP servers and it happens in all of them, also, I've used 
variants of the method, calling it with and without parameters. I've 
successfuly changed the working directory to a directory that I know that 
contains files and it still does not work. This is the piece of code:

 FTPClient f= new FTPClient();
 f.connect(server);
 f.login(user,pssw); 

 FTPFile[] files = f.listFiles();
System.out.println("Number of files in the directory: " + files.length);
 for(int i=0;i< files.length;i++){
 System.out.println("files:" + files[i].getName());

I can't find why it does not work. If someone could point me the error I 
would appreciate it.

Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message