TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dc
NA
663
0
C# exclude files from directory search
Oct 9 2012 11:46 PM
In a C# 2010 application, I am currently using the following to statements to select files for *summ.xls files.
string[] files = Directory.GetFiles(C:\temp\09_20_2012\CUSTOMER1, "*summ.xls",SearchOption.AllDirectories);
string[] files = Directory.GetFiles("C:\\temp", "*summ.xls", SearchOption.AllDirectories);
However now I need to exclude the following kind of files from the next directory search:
1. *summ.xlsx,
2. *report.xlsx,
and
3. invalid*.xlsx. In this case the files start with the word invalid and the rest of the file name can be anything. However these files are also of type *.xlsx.
Thus for like the statement,
"string[] files = Directory.GetFiles("C:\\temp", "*summ.xls", SearchOption.AllDirectories);",
can you tell me how I would change the statement above to exclude the specific
file names I just listed above?
Can you show me how to make this coding change and/or point me to a reference I can use to solve the problem?
Reply
Answers (
1
)
How to convert or cast System.IntPtr into System.Drawing.Image or Bitmap ???
extract information relating to Group or user names for Directory and Sub-directories