EldoS | Feel safer!

Software components for data protection, secure storage and transfer

FTP GetFileList Parser

Posted: 06/05/2007 10:20:06
by Jesse Terrell (Standard support level)
Joined: 05/29/2007
Posts: 24

When using the ElSimpleFTPSClient.GetFileList method I get several lines of text representing the complete file and directory descriptions of the current working directory. Does anyone know an elegant and accurate way to parse these lines into file names and file types (ie, directory, file, special, etc.)?
Posted: 06/05/2007 10:43:52
by Eugene Mayevski (Team)

FTP specification doesn't define exact format of the data. There exist about 400 (four hundred) disfferent formats. There's a Delphi library called Indy and it's developers have created parsers for those 400+ formats.

We provide a parser for common Unix format via ParseFileListEntry method of ElSimpleFTPSClient.

The problem has been solved by introducing MLST extension command to FTP. This command is supported by many servers. It's use in ElSimpleFTPSClient is similar to GetFileList - you use MLSD() method (Machine-parseable LiSt of Directory) and then call ParseMLSDEntry() method to parse the results that you obtained via OnTextDataLine event.

Before you use MLSD, you need to check whether it's supported using ExtMLSTSupported property.

Sincerely yours
Eugene Mayevski
Posted: 06/05/2007 11:04:58
by Jesse Terrell (Standard support level)
Joined: 05/29/2007
Posts: 24

Thank you very much. I read that help file 20 times and still didn't see the ParseFileListEntry() and ParseMLSDEntry() methods until you pointed them out in your patient reponse. I need more coffee.



Topic viewed 2549 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!