Unexpected result in .NET 4 DirectoryInfo.EnumerateFiles(string)
- by xkingpin
It seems that the following code is not working as expected. I would assume that the following call to EnumarateFiles would only return files that match the filename pattern of c* ... however, filenames with H* are still getting returned. For example... the following file will get deleted in the following code (HNNN09060900932.xml). What's the issue? This is a major bug in my application.
string searchPattern = "C*";
// get each file in this directory that is less than a given date
var files = from file in SubDir.EnumerateFiles(searchPattern)
where file.LastWriteTime < KeepDate
select file;
foreach (var file in files)
{
file.Delete();
}