How to count huge amount of files in folder

M

MichiMichi

My asp.net application has a directory which is filled up with over 17
files (email) a second. After a while this sums up into a huge amount
of files.

I usually count files with the GETFILES method. This works perfectly
of there are only a few hundert files in the folder

*********
.....
Dim files() As String
files = IO.Directory.GetFiles(mycontext.Server.MapPath(".\myFolder
\"), "*")
.....
*********

When my application goes offline than it can happen that over 200,000
files are waiting in the folder to be processed.
The method GETFILES does not work anymore. There are just to many
files. I can wait for hours any nothing happens.

Is there a better method to count files inside a folder for ASP.NET
2.0?
 
P

Patrice

You could try win32. If I remember the problem is that the collection
returns data once all files are processed. Win32 allows to return each name
in turn plus it could be quicker if you are not even interested in storing
details...

Also another option would be to closely look if you really need this number
(for example you could perhaps queue this to a file or a DB or in different
directories to avoid overblotting a single directory, or you could number
your files and using the last processed and last created could give a usable
value depdning what you are doing with this number etc...).
 
G

Guest

MichiMichi said:
My asp.net application has a directory which is filled up with over 17
files (email) a second. After a while this sums up into a huge amount
of files.

I usually count files with the GETFILES method. This works perfectly
of there are only a few hundert files in the folder

*********
....
Dim files() As String
files = IO.Directory.GetFiles(mycontext.Server.MapPath(".\myFolder
\"), "*")
....
*********

When my application goes offline than it can happen that over 200,000
files are waiting in the folder to be processed.
The method GETFILES does not work anymore. There are just to many
files. I can wait for hours any nothing happens.

Is there a better method to count files inside a folder for ASP.NET
2.0?

Take a look this article
http://msdn.microsoft.com/msdnmag/issues/05/12/NETMatters/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top