commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <>
Subject RE: questions about FTP LIST processing (FTPFileListParser)
Date Wed, 10 Dec 2003 21:54:57 GMT
No, that part of the system is not very well developed.  It is not as
currently developed, suitable for any sort of automated detection.
You'll have to try FTPClient.getSystemName() and work out the mappings
yourself.  Sorry.

This would be an excellent enhancement request, if not for the fact that
the FTP spec itself is so old and vague.  (Try looking for a standard
date format across different locales for example).  FTP was not designed
for automation.  

Also, be careful, that javadoc for NTFTPEntryParser is not quite
correct.  I've just entered a bug on that.

More up-to-date way is:
FTPClient f=FTPClient();
f.login(username, password);
FTPFileList list = createFTPFileList(directory, parser);
FTPFileIterator iter = list.iterator();

parser = new XXXFTPEntryParser(); // instantiate an FTPFileEntryParser
object of the appropriate type.
while (iter.hasNext()) {
     FTPFile[] files = iter.getNext(25);  // "page size" you want
       //do whatever you want with these files, display them, etc.
       //expensive FTPFile objects not created until needed.

-----Original Message-----
From: Chris Malley [] 
Sent: Wednesday, December 10, 2003 2:49 PM
To: Jakarta Commons Users List
Subject: Re: questions about FTP LIST processing (FTPFileListParser)

Thanks Steve.  Helpful to know that Default is UnixFTPEntryParser (this
should really be in the javadoc if anyone from commons-dev is

So part 2 of my question was: how do I decide which parser to use? The
javadoc for NTFTPEntryParser eludes to using 
FTPClient.getSystemName. Are there specific system name values (or parts
of the system name) that tell you to use a specific parser? Or am I
going to have to determine a parser via trial-and-error and keep a
mapping of hostname-to-parser? (yuck)


Steve Cohen wrote:
> Default is UnixFTPEntryParser.  I don't know what's different about 
> EnterpriseUnixFTPEntryParser, someone contributed that. The others are

> pretty straightforward, NT, OS2, VMS.  No doubt there are others.  If 
> these don't fit your pattern, consider writing your own and 
> contributing it.  It's pretty straightforward, you can use the others 
> as models, if you understand regular expressions.
> -----Original Message-----
> From: Chris Malley []
> Sent: Wednesday, December 10, 2003 2:03 PM
> To:
> Subject: questions about FTP LIST processing (FTPFileListParser)
> I'm writing an FTP client that makes heavy use of the 'LIST' command,
> and I'm operating in an enviroment that has a wide range of FTP server

> types.  So the 'LIST' output is apt to vary.  The answers to these 
> questions have eluded me so far:
> Which FTP servers does DefaultFTPFileListParser handle?
> How do I decide when to use the various list parsers that are
>   (i.e., EnterpriseUnixFTPEntryParser, NTFTPEntryParser,
> OS2FTPEntryParser, UnixFTPEntryParser, VMSFTPEntryParser) Should I
> at FTPClient.getSystemName()?...
> Thanks,
> -Chris

Chris Malley
Contractor - PixelZoom, Inc.
Email @ EMC:
Voice @ EMC: (303)293-9331 x1235

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message