Directory.GetFiles Doesn't return file
I've manually created a text file named AAAAA.txt in c: \ windows \ System32 when I execute the following code:
var sys32Files = Directory.GetFiles(@"C:\windows\System32");
It returns a bunch of files, but AAAAA.txt is not on this list. All permissions for the AAAAA.txt file are the same as for the files that are returned.
Can someone please explain what might be the problem here?
And yes, I work as an administrator.
source to share
You have a 64 bit machine and a 32 bit process is running. Forwarder means C:\Windows\system32
redirecting to C:\Windows\SysWOW64
. If you want to search for files in C:\Windows\system32
, you can use an alias C:\Windows\sysnative
. Or compile for 64 bit.
Of course, you shouldn't create files in the system directory in the first place. It belongs to Windows and you should leave it alone.
source to share