Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.2k views
in .NET FTP by (140 points)
How do I get a count of the number of files in the current working directory on the server (including all files in subdirectories)? I see examples that reference FTPClient but I don't have or am not using it. All my app is working with is ExFTPConnection and FTPRemoteFileList.

Any help would be appreciated...

Bobby

1 Answer

0 votes
by (51.6k points)
If you've already got an FTPRemoteFileList on the form then it will be requesting directory listings every time you change directories. This means that you can simply handle the ExFTPConnection.DirectoryListed event and grab the number of files from the FTPDirectoryListEventArgs argument. This argument has a property called FileInfos, which is an array of FTPFile objects. This array will contain both files and directories, and sometime include entries for ".." and ".". You may want to make sure you only count the files/directories you are interested in by iterating through the array.

- Hans (EnterpriseDT)

Categories

...