I have a simple problem. My (Delphi 2007 with Indy 9) application connects to an FTP server to retrieve a list of files. (NLST, not LIST) I then download every file separately for further processing.
Unfortunately, the administrators of the FTP site added a subfolder in the folder where the files are located. The current code thinks it's a file, thus it tries to download it. This fails, of course. Right now, I just solved it by checking if the process succeeded or not and if not, it will add a message to the error log but it also continues processing other files.
But what I would like to do is add some code which will check first if the name in the filelist is a filename or foldername. What's the easiest way to do this?
Note: I cannot rely on the LIST method to return a file list with additional attributes since I'm connecting to multiple FTP servers which could all define their own file format. Besides, parsing such a list isn't a very easy task, even if I could determine which kind of list the FTP server returns. To make matters worse, some of the filenames are just numbers with no extension so wildcards don't help either.