P
Paul K
I seem to be running into a problem with the
DirectoryInfo.GetFiles method. If I use this method with
a search pattern on a few files there is no problem, but
as soon as the number of files grows somewhat large, it
seems to lock up. For example, I iterate through the
array returned by the GetFiles method and test for the
presence of a string in each file. Here's some code:
StreamReader sr;
foreach (FileInfo fi in di.GetFiles("*.PSM"))
{
sr=fi.OpenText();
..
..
..
}
With a few files (maybe 10 - 15) there is no problem, but
when I test it with more (around 50 - 70), it just seems
to lock. I doubt (but I could be wrong) that there is a
problem with the DirectoryInfo class regarding larger
numbers of files, so does anyone have any idea what I am
missing or doing incorrectly (or a better alternative)?
Paul
DirectoryInfo.GetFiles method. If I use this method with
a search pattern on a few files there is no problem, but
as soon as the number of files grows somewhat large, it
seems to lock up. For example, I iterate through the
array returned by the GetFiles method and test for the
presence of a string in each file. Here's some code:
StreamReader sr;
foreach (FileInfo fi in di.GetFiles("*.PSM"))
{
sr=fi.OpenText();
..
..
..
}
With a few files (maybe 10 - 15) there is no problem, but
when I test it with more (around 50 - 70), it just seems
to lock. I doubt (but I could be wrong) that there is a
problem with the DirectoryInfo class regarding larger
numbers of files, so does anyone have any idea what I am
missing or doing incorrectly (or a better alternative)?
Paul