There are several good articles on CodeProject containing different implementations of FTP Clients by using
WinInet functions. But since
WinInet FTP is limited by itself (provides only basic implementation of FTP protocol) these implementations also inherit these limitations.
For example, you cannot retrieve the file attributes or owner information and cannot change them by using
Fortunately, starting with Internet Explorer 5.0 and later, you can use the
FtpCommand function to send direct commands to the FTP Server and parse results by yourself.
In this example, I send “
LIST” command to the FTP Server and use “D. J. Bernstein, http://cr.yp.to/ftpparse.html” ftpparser to analyze results. I have modified the ftpparser a little for this article.
In this sample, I use only the “
LIST” command. You can send any allowed command to the FTP server. For example, to change file permissions, you can send “
SITE CHMOD ...”, to retrieve single file attributes/permissions you can use “
STAT ...”, etc. Refer to RFC 959 to get more information about all possible FTP commands.
- 31st March, 2006: Initial post