Archived Forum Post

Index of archived forum posts

Question:

FTP NumFilesAndDirs does not see all files?

Oct 13 '12 at 04:33

When I do:

     countFiles = dirListing.NumFilesAndDirs;
    

I get 2 files, but there should be 3 files. Why do I not see all 3 files?


Answer

To understand the problem you need to get more information. There are two sources:

1) Examine the contents of the LastErrorText property after accessing the NumFilesAndDirs property. The LastErrorText always contains information about the last Chilkat method called or property accessed, even if it was successful. The reason is that it allows one to get more information for the cases where a Chilkat method behaves unexpectedly, yet still succeeds. In this case, you may also set the VerboseLogging property = true to get more verbose information in the LastErrorText.

2) Tell the FTP2 object to keep an in-memory session log by setting the ftp2.KeepSessionLog property = true. Then after accessing NumFilesAndDirs, examine the contents of the ftp2.SessionLog property. You can then see the raw directory listing retrieved from the FTP server and compare it with your results. The SessionLog combined with the LastErrorText should provide enough information to understand the problem. If you think it's a problem within the Chilkat FTP2 component, maybe somehow the directory listing was not parsed properly, then send the LastErrorText and SessionLog to support@chilkatsoft.com. However, be absolutely sure you are testing using the latest version of the component/lib because if not, then the 1st response will be to re-test using the latest version.


Answer

Could it be the listPattern is set causing the difference?

http://www.example-code.com/csharp/ftpListPattern.asp