简体   繁体   English

c#Directory.GetFiles()-NTFS上的多个文件

[英]c# Directory.GetFiles() - multiple files on NTFS

Using System.IO.Directory.GetFiles() like this 像这样使用System.IO.Directory.GetFiles()

string[] fileFullPaths1 = Directory.GetFiles(@"C:\Windows\System32", "mycompanyname.scr");
string[] fileFullPaths2 = Directory.GetFiles(@"C:\Windows\SysWOW64", "mycompanyname.scr");

I find the following two files: 我找到以下两个文件:

  • C:\\Windows\\System32\\mycompanyname.scr C:\\ WINDOWS \\ SYSTEM32 \\ mycompanyname.scr
  • C:\\Windows\\SysWOW64\\mycompanyname.scr C:\\ WINDOWS \\ Syswow64资料\\ mycompanyname.scr

Windows explorer cannot see the one in C:\\Windows\\System32, nor can a command line dir. Windows资源管理器无法在C:\\ Windows \\ System32中看到该文件,命令行目录也看不到。 Furthermore, my own code that searches the MFT shows that there is only one instance of mycompanyname.scr in the MFT and its parent directory record number points to C:\\Windows\\SysWOW64, so I don't think that hard links are confusing the issue. 此外,我自己搜索MFT的代码显示,MFT中只有一个mycompanyname.scr实例,其父目录记录编号指向C:\\ Windows \\ SysWOW64,所以我认为硬链接不会使问题。 I have also checked that neither of the two directories are junction points. 我还检查了两个目录都不是连接点。

Could someone please explain why this is? 有人可以解释为什么吗?

WOW64 means Windows-on-Windows 64-bit . WOW64表示Windows-on-Windows 64-bit

SysWOW64 is used to put 32-bit program. SysWOW64用于放置32位程序。
System32 is used to put 64-bit program. System32用于放置64位程序。

For 32-bit programs, C:\\Windows\\System32 will always be redirected to C:\\Windows\\SysWOW64 . 对于32位程序, C:\\Windows\\System32将始终重定向到C:\\Windows\\SysWOW64
For 64-bit programs, C:\\Windows\\System32 will be redirected to C:\\Windows\\SysWOW64 if file doesn't exist 对于64位程序,如果文件不存在, C:\\Windows\\System32将被重定向到C:\\Windows\\SysWOW64

You can complie your program to x86 and try again. 您可以将程序编译为x86,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM