subDirList
contains filenames, not only extensions. That's why you're finding nothing.
You should probably use Any
with EndsWith
:
if (subDirList.Any(x => x.EndsWith(".idx")) && subDirList.Any(x => x.EndsWith(".log")))
Or if .idx
and .log
are not extensions, but just part of filename, use Contains
:
if (subDirList.Any(x => x.Contains(".idx")) && subDirList.Any(x => x.Contains(".log")))