In a C# 2008 console application, I want to select files from a specific folder location and then select certain excel spreadsheets from that location. I want to pick files where the first part of the name can be anything but the last part of the name is summ.xlsx.
I know I can pick the directory path with a statement that looks like the followinng:
If (Directory.Exists(strFullpath)).
I know that if I want to ask if a file exists by the full name, I would say:
if (File.Exists("CompanyName_summ.xlsx").
However in this case I want to pick files where the last part of the name ends with
summ.xlsx. Note: Due to the fact there are several kinds of *.xlsx files that will reside in the specific directory, I can not pick the files by the *.xlsx file extension alone.
Thus can you tell me how I would write the code to ask if "_summ.xlsx" exist in the selected directory? Also if the files exist, I would also like code and/or be pointed to a reference that will show me how to access the excel spreadhseet(s).
Loading

VulpesRank #55 · 29.2K reputationPosted Oct 8, 2012, 6:52 AM EDT
Yin45 reputationPosted Oct 7, 2012, 6:56 PM EDT
dcRank #2,247 · 627 reputationPosted Oct 8, 2012, 5:48 AM EDT
dcRank #2,247 · 627 reputationPosted Oct 8, 2012, 10:13 AM EDT