linq - C# Directory.GetFiles with mask -
in c#, files specific directory matches following mask:
- prefix
"myfile_"
- suffix numeric number
- file extension
xml
i.e
myfile_4.xml myfile_24.xml
the following files should not match mask:
_myfile_6.xml myfile_6.xml_
the code should somehing this (maybe linq query can help)
string[] files = directory.getfiles(folder, "???");
thanks
i not regular expressions, might -
var myfiles = file in system.io.directory.getfiles(folder, "myfile_*.xml") regex.ismatch(file, "myfile_[0-9]+.xml",regexoptions.ignorecase) //use correct regex here select file;
Comments
Post a Comment