Problem in getting files in a directory

H

Hemant

Hi,

We are getting "Out of Memory" exception while using Directory.GetFiles()
method if there are large number of files present in the directory on which
the method is being executed.

We would like to have an alternate solution for picking files from the
directory, like picking only 10 or 15 files at a time.

Is there anything in GetFiles() method with which we can tweak in its
functionality to pick only a certain number of files? Or if there's an
alternate solution for the same, please do let us know.



Thanks,

Hemant
 
G

Gregory A. Beamer

Is there anything in GetFiles() method with which we can tweak in its
functionality to pick only a certain number of files? Or if there's an
alternate solution for the same, please do let us know.

Are you using Directory or DirectoryInfo. the info classes are much less
weighty. I am not sure this will solve the problem, as both should just
get the names.

In the 4.0 Framework, there are more efficient file manipulation
methods, but that means heading into a beta to get your answer. There is
a "Go Live" on beta 2, but it is still beta.

Peace and Grace,
 
H

Hemant

Hi,
Actually, in our case, its more than 5000 files that client puts in the
directory and after that our windows service picks up those files to
process.


Also, the search criteria filter does not help much because the filenames
are almost similar i.e. starting with same letters/words.

Is there any other option that we can use to avoid this memory issue?

thanks,
Hemant
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top