It looks like the DirectoryInfo
class is using the Win32 FindFirstFile
call under the hood.
This allows only wildcards:
*
to match any character
?
to match 0 or more characters - see comments .
Therefore, you will have to filter the results yourself, possibly using the following:
directoryInfo.EnumerateFiles("*.xls", SearchOption.TopDirectoryOnly) .Where(fi => fi.Extension == ".xls");
source share