EldoS | Feel safer!

Software components for data protection, secure storage and transfer

FTP GetFileList Parser

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#3068
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.)?
#3070
Posted: 06/05/2007 10:43:52
by Eugene Mayevski (EldoS Corp.)

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
#3071
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.

Reply

Statistics

Topic viewed 2367 times

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




|

Back to top

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

Got it!