dc

dc

  • NA
  • 663
  • 0

C# search file structure

Oct 12 2012 2:52 PM
In a C# 2008 application, I need to do 2 different directory searches which are:
1. In one directory search I need to look for ".xlsx",".pdf", or *.pdf files. These files are located in a directory path that looks like the following: "C:\temp\mm-dd-yyyy\(customer_number)\docs.

Thus the first part of the search will "C:\temp" and the last part of the search will be looking for the folder called "docs".

Thus can you tell me how to modify the statement below and/or come up with a  different statement that will fullfil my search requirements:

string[] files = Directory.GetFiles("C:\\temp", "*.pdf", SearchOption.AllDirectories);

2. The second search needs to look for a folder that has the customer number in it.

Thus can you tell me how to code these searches and/or point me to references that will help me work on these searches?

Answers (2)