Hi

I've got a program which gets a list of file names from an Amazon S3 bucket, which I connect to via a mapped drive in TNTDrive.

It usually works fine, but I've hit a limit with an unusually large folder which has 75887 files in it.

Here's the basic code:

Code:
Dim dirfiles() As String = IO.Directory.GetFiles(foldername)

For Each myfilename In dirfiles
   myfiles_list.Add(myfilename)
Next

(myfiles_list is a list of strings.)

I'm getting a 'The semaphore timeout period has expired' error. It only managed to get 3 of the files into my list, then it apparently did nothing until it timed out.

I don't know why it stopped at just 3, but it works with folders of fewer files, so quantity must be the issue.

I've got around problem this temporarily by getting a directory listing from a DOS dir command and directing it to a text file, then reading this text file into the myfiles list instead of reading the directory directly.

Can anyone suggest a way to tackle this please?

Thanks!