c# - How to count the number of matches of files in a directory -
i looking many questions after answering this.
how find if in directory exists @ least 1 (and better if give me number of) files matches regular expression?
i know can loop files in directory with answer
but there way of counting without looping?
i try count() don't work
taken linked question / answer, should work:
int count = directory.getfiles(@"c:\temp").count(path => regex.ismatch(path, pattern));
Comments
Post a Comment