richard smith

richard smith

  • 1.5k
  • 285
  • 160.2k

Search Directory for Array of filenames

Jan 28 2013 11:29 AM
I have 3 - 5 filenames that will be in either 3 - 4 directory's.  So for example NOF1 = "Finalized_Data" NOF2 = "Final_Data" NOF3 = "Fin_Data" could be in dir1 = "C:\Test\Data\ready\" or dir2 = "C:\Test\Data\"
or dir3 = "C:\Test\Data\Ready Files\" or dir4 = "CL\Test\Data Ready\"

What would be the C# code to search each of those directories for each of the filenames?

If you need to see the larger picture, I want to find the file, open the file, refresh the sql query in the workbook and save it.  I know C# code to open/refresh/save, I just don't know how to search for an array of workbooks in an array of directories.

Answers (2)