There's no standard or general solution for formats of the listing response to the FTP LIST
command. The LIST
command is what is behind the ListDirectoryDetails
method of the FtpWebRequest
.
The LIST
command was introduced at times, when machine parsing was probably not expected (early 1980's).
To overcome this problem the MLSD
command was introduced later. Format of a listing for this command is defined by the RFC 3659. An official example:
Type=cdir;Modify=19981107085215;Perm=el; tmp
Type=cdir;Modify=19981107085215;Perm=el; /tmp
Type=pdir;Modify=19990112030508;Perm=el; ..
Type=file;Size=25730;Modify=19940728095854;Perm=; capmux.tar.z
Type=file;Size=1830;Modify=19940916055648;Perm=r; hatch.c
Type=file;Size=25624;Modify=19951003165342;Perm=r; MacIP-02.txt
Type=file;Size=2154;Modify=19950501105033;Perm=r; uar.netbsd.patch
Type=file;Size=54757;Modify=19951105101754;Perm=r; iptnnladev.1.0.sit.hqx
Type=file;Size=226546;Modify=19970515023901;Perm=r; melbcs.tif
Type=file;Size=12927;Modify=19961025135602;Perm=r; tardis.1.6.sit.hqx
Type=file;Size=17867;Modify=19961025135602;Perm=r; timelord.1.4.sit.hqx
Type=file;Size=224907;Modify=19980615100045;Perm=r; uar.1.2.3.sit.hqx
Type=file;Size=1024990;Modify=19980130010322;Perm=r; cap60.pl198.tar.gz
Unfortunately the .NET framework does not support the MLSD
command.
You have to use a 3rd party FTP client library/assembly to take advantage of the standardized MLSD
command.
See also