Search for Files with System.IO.DirectoryInfo.GetFiles()

  • Thread starter Thread starter Brian Reed
  • Start date Start date
B

Brian Reed

I am trying to locate all image files in a particular folder. I use the
System.IO.DirectoryInfo to open information about the specific directory. I
am then trying to query all of the images in that folder whether the
extension be .jpg, gif, or bmp. So far I have not had any luck passing more
than one extension to 'GetFiles(String searchPattern). Is there a way to
pass more than one extension to this method?

Also is there a better way to search for files? Something more along the
lines of FindFirstFile from the Win32 API?

Thanks for the help

Brian
 
* "Brian Reed said:
I am trying to locate all image files in a particular folder. I use the
System.IO.DirectoryInfo to open information about the specific directory. I
am then trying to query all of the images in that folder whether the
extension be .jpg, gif, or bmp. So far I have not had any luck passing more
than one extension to 'GetFiles(String searchPattern). Is there a way to
pass more than one extension to this method?

You will have to perform multiple calls to 'GetFiles'.
Also is there a better way to search for files? Something more along the
lines of FindFirstFile from the Win32 API?

I don't think that this will be much faster than this:

<http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/RecursiveFileScan.zip>
 
Back
Top