In TIdFTP, is there a method to parse the contents of the List result, so I can use a ListView component to display the directory?
The original FTP RFC 959 never standardized a common directory format for the LIST command. A FTP server was free to list files in whatever format it wanted. It often is dependant on the platform the computer is running on although some FTP servers will emulate Unix.
For Indy 8.0
In Indy 8.0, you have to write your own parsing routines for different types of FTP servers. We recommend that you upgrade to Indy 9.0 because that Indy version has directory parsing support for Unix and MS-DOS.
If you only want file or directory names, you can use the Details = False parameter such as:
IdFTP1.List(MyStrings, '', False);
In Indy 9.0
Most of the time, you can get a directory listing by using the TIdFTP.DirectoryListing property to access a collection of TIdFTPListItem objects. Please see the Indy Help File documentation for TIdFTPListItem. The Indy 9.0 directory parsing code only supports Unix and MS-DOS directory list formats. This is not as bad as it seems because many FTP servers emulate Unix including some modern mainframes, MacIntosh servers (e.g. AppleShare IP FTP Server, NetPresenz), current AMOS servers, and most freeware/shareware Windows FTP Servers. You may have to upgrade to the current Indy 10 development versions or write your own parsing code if you need more capability.
In Indy 10 Development Versions
In the current Indy development versions, we have added parsing code for the following servers:
|•||Bull GCOS 7 or Bull DPS 7000|
|•||Bull GCOS 8 or Bull DPS 9000/TA200|
|•||HellSoft FTP Server for Novell Netware 3 and 4|
|•||HP 3000 or MPE/iX including HP 3000 with Posix|
|•||Music (Multi-User System for Interactive Computing)|
|•||NCSA FTP Server for MS-DOS (CUTCP)|
|•||Novell Netware Print Services for UNIX|
|•||VMS or VMS (including Multinet, MadGoat, UCX)|
and starting with Indy 10 build 51, support has been added for:
|•||NCSA FTP Server for MacIntosh|
|•||Unisys ClearPath Enterprise Server (OS2200 or MCP)|
Even with this code, you still may encounter servers that give directory listings that Indy does not support so you may still have to write your own code and this new code is far from perfect because sometimes, we could only find scant data to work with. On the other hand, most FTP servers developed today use the Unix System FTP list format and many servers are Unix-like systems such as Linux, HP UX, FreeBSD, Solaris, and AIX.
The MLST and MLSD commands described in the IETF Draft, Extensions to FTP
(draft-ietf-ftpext-mlst-16) require a standardized listing format. While some servers support them, there are still many servers still do not support this at all and in one case, the data is not as good as the information from the standard LIST command. To enable TIdFTP to use the MLSD command, set the UseMLIS property to true and TIdFTP will use those commands if the server supports them.