In the previous article, we discussed RFC 959, which defines how an FTP server should work. We also walked through some of the commands that are used in this protocol. In this article, we will be creating an example FTP server in Delphi.
The Implementation of an FTP Server - Listing Files (Page 4 of 6 )
This is perhaps the most important procedure of them all. This event lists all the files in a given directory. It is from here that you can manipulate all the files on a file system. So let's step carefully through the code.
The first thing that we do is use the FindFirst/FindNext functions to run through any files that may be in a directory. So we use the path that the client sent, which is stored in the Apath variable: