Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FindFirstFile in C# ?

Status
Not open for further replies.

Bugmaster

Programmer
Joined
Sep 25, 2006
Messages
1
Location
US
Hi all, I'm a newbie to C#, so please excuse me if this is a stupid question.

I need to write a program that will perform some parsing on each file in a given directory. Microsoft recommends using DirectoryInfo.GetFiles for this. Unfortunately, this particular directory can contain thousands of files; thus, the DirectoryInfo.GetFiles call takes a long time, and there's a large overhead for opening each file.

Is there a way in C# to iterate through the files one-by-one, similarly to how the Win32 FindFirstFile/FindNextFile API work ? In general, what is a good way to iterate through thousands of file in a single directory ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top