c# EnumerateFiles wildcard returning non matches?

Posted by Sam Underhill on Stack Overflow See other posts from Stack Overflow or by Sam Underhill
Published on 2011-03-10T15:41:00Z Indexed on 2011/03/10 16:10 UTC
Read the original article Hit count: 171

Filed under:
|

As a simplified example I am executing the following

IEnumerable<string> files = Directory.EnumerateFiles(path, @"2010*.xml", 
    SearchOption.TopDirectoryOnly).ToList();

In my results set I am getting a few files which do no match the file pattern. According to msdn searchPattern wildcard is "Zero or more characters" and not a reg ex. An example is that I am getting a file name back as "2004_someothername.xml".

For information there are in excess of 25,000 files in the folder.

Does anyone have any idea what is going on?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET