5
Answers

locate certain files in a directory structure

dc

dc

12y
1.6k
1

In a C# 20008 application, I would like to accomplish the following task:
1. I would like to find all the files named *summ.xls that exist in a general folder structure like: C:\temp. However all the files individually are at lower levels like
C:\temp\09_20_2012\CUSTOMER1.

I would like to be able search for the files giving only a partial path.

I know the following would work if I gave the full file path of
string[] files = Directory.GetFiles(C:\temp\09_20_2012\CUSTOMER1, "*summ.xls");

However I would like to know how to search for the "*summ.xls" by only giving the path C:\temp.

This way I would be able to look for all the applicable spreadhseets I need to work with.

2. Is there a way to be able to tell when the directory was last searched for a file? If so, how can I setup code to check for the "*summ.xls" file in the C:\temp directory from the last time the search was setup?




Answers (5)