Problem with ListNames and directory entries (General questions)
I believe I have found a bug in the ftp control where ListNames is not properly identifying directory entries.
The documentation states that all directory entries returned by ListNames will have a trailing /. As such, this is what I was looking for in order to filter out directory entries.
During my testing, connecting to ProFTPd on Linux, I have found that the ListNames does NOT return directory entries with the trailing /. This is something of a showstopper for me and I am wondering what it might take to fix this.
There are no permissions issues, as the ftp user account has full ownership over all files and directories.
Here is a listing of one sample directory, in case it helps:
ls -la
total 12
drwxrwxr-x 3 mike mike 4096 Sep 15 16:09 ./
drwxrwxr-x 4 mike mike 4096 Sep 15 16:27 ../
drwxrwxr-x 2 mike mike 4096 Sep 15 16:09 archive/
-rw-r--r-- 1 mike mike 0 Sep 15 15:35 ftpoutbound_fromlocalsystem.txt
Is there any quick or easy workaround for this issue?
Re: Problem with ListNames and directory entries
Mike,
in FTP protocol we depend on result of NLST command. Most servers return / at the end, but some don't. We cannot know if remote entry is a dir or a file, so we provide list 'as is'.
I'm sorry, but there's not much we can do about it. Why don't you use ListDir and then DirItems collection instead?
Re: Problem with ListNames and directory entries
I also just confirmed this behavior when connecting to Microsoft IIS-based FTP servers.
Re: Problem with ListNames and directory entries
Mike,
of course. In FTP protocol this all depends on the server. In SFTP protocol we can show / if we decide it on the client side, but in FTP protocol it all depends on the server.
Re: Problem with ListNames and directory entries
I re-implemented the directory listings using the method you suggested, which worked beautifully. I would have used this in the beginning had I know of the potential issues with ListNames.
Perhaps you might note the potential pitfalls of using ListNames in the documentation and suggest the newer method instead. :)
Thanks again,
Mike