I need to find a file(s) that begin with the character “prft” the name of this files is “prft0000.140”, “prft2100.140”, “prft1258.140″… etc. And I need to verify if this file(s) exists in a directory specific. So I have this Regex for find them, but I don’t know how write the filter to match.
List<string> prftFiles = (new DirectoryInfo(filePath))
.GetFiles(".", SearchOption.AllDirectories)
.Where(a => Regex.IsMatch(a.Name, "prft[^*]$"))
.Select(fi => fi.Name)
.ToList();
this not work “prft[^*]$”, so, How is it??
why not just do
List prftFiles = (new DirectoryInfo(filePath)).GetFiles("prft*", SearchOption.AllDirectories)