• Post Reply Bookmark Topic Watch Topic
  • New Topic

FTPClient error when using .listFiles()  RSS feed

 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Here's my code:

FTPClient ftp = new FTPClient();
ftp.enterLocalPassiveMode();
ftp.connect("ftp.someserver.net");

ftp.login("hhehe","44445");

ftp.changeWorkingDirectory("folder");

System.out.println("Welcome message:"+ftp.getReplyString());
FTPFile[] files = ftp.listFiles();

//getting error here...
System.out.println( "Number of files in dir: " + files.length );

ftp.disconnect();

System.out.println("disconnect successful");



I'm getting a MalformedPatternException when the execution gets to ftp.listFiles()..why is this happening?
 
Joe Ess
Bartender
Posts: 9426
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Q: On which server operating systems is FTPClient able to bring back a parsed listing?

A: Currently parsers have been written for UNIX, Windows, OS/2, Netware, VMS and OS400. These can be autodetected by the code without being specified. Additionally, the code correctly handles cases where NT or OS400 servers have been configured to look like unix servers. There is also a means of specifying a user-written parser by class name. All of these parsers return FTPFile objects with as much information about the file as can be gathered from the listing.

If none of these is sufficient, FTPClient.listNames() may always be called. This retrieves just the file name without other information.

Jakarta Commons Net FAQ
 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link Joe. The FAQ page certainly answered my questions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!