The following method call returns all xml files in the given directory.
FileInfo[] Files = Directory.GetFiles("*.xml");
I would like to get all XML files in the directory where the fileName does not end with “_update.xml”
for example…. if I have the following files
ABC.xml
ABC2.xml
ABC3_update.xml
then I want a call that will only return:
ABC.xml
ABC2.xml
Is this possible?
I don’t believe you can use search wildcards for that kind of exclusion. You can, however, filter the list of files after the fact. It’s quite easy with LINQ. Although, if your directory is very large, this may result in a lot of processing of the file list in memory.
Try: