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?
Loading
Sudhakar ChaudharyPosted Oct 12, 2012, 6:59 PM
Nitesh KejriwalPosted Oct 12, 2012, 3:58 PM
String foldernName = "C:\\temp\\";
folderName += Datetime.Now.ToShortDateString() + "\\";//To Add the date in your format
folderName += "Customer_number" + "\\";
folderName += "docs";
string[] files = Directory.GetFiles(folderName, "*.pdf", SearchOption.AllDirectories);