I'm trying to enumerate files in C:\Windows\system32
and C:\Windows\SysWow64
. But I'm missing files csrss.exe
and lsass.exe
and possibly more, I only checked these two files.
Those files are there, I can see them in total commander and in explorer. They are just not in the enumeration result.
List<string> result = new List<string>(Directory.EnumerateFiles("C:\\Windows\\system32", "*.exe", SearchOption.TopDirectoryOnly));
I tried using DirectoryInfo
instead of Directory
with same result.
Also tried this:
List<string> result = new List<string>(Directory.EnumerateFileSystemEntries("C:\\Windows\\system32", "*.exe", SearchOption.TopDirectoryOnly));
And this:
var dir = new DirectoryInfo("C:\\Windows\\system32");
var result = dir.EnumerateFiles("*.exe", SearchOption.TopDirectoryOnly);
Variable 'result' is not empty, but it doesn't contain mentioned files.
Framework version: v4.0.30319
Windows7: 6.1.7601 x64
Note: I know I can use workaround: dir /a-d /b C:\Windows\system32
and then parse output. But I would like to avoid this.