in reply to Parsing FTP ls command results
Yes, it's unfortunate that the FTP protocol doesn't specify the format for the ls and dir commands. Certainly there would be differences between the available information on different operating systems, but rather than leaving it totally unspecified, I'd've preferred that they have a fixed set of information on the front of each line, with "extra" information in free-format afterwards so this wouldn't be a problem.
For example, the first line should be a header line (to describe the columns). Then each remaining line should have the filename, the size (if known), and date/time last changed (if known) with other information changing by OS after that. Were it specified that way, then your client could *always* use the same code to find the filenames available if it didn't care about the other information.
I have that problem frequently, as many of my programs must interface with an FTP server running on a zOS mainframe with its own peculiarities....
So you'll likely want to read 'perldoc perlfunc' and look at the entries for unpack and substr to see how to parse it.
...roboticus
|
|---|