在 Windows 文件系统中,每个文件是否都有预先计算的哈希值?
我想通过哈希值搜索重复的文件。出于性能目的,我想知道 NTFS/FAT 文件系统中的每个文件是否存储了哈希/校验和。如果有,我不必计算所有这些来搜索我的文件。
如果有,如何使用.NET访问它?
如果有帮助的话,它将是 JPEG 文件。他们有校验和吗?
I want to search a file duplicate by its hash. For performance purposes I want to know if there is a stored hash/checksum for each file in NTFS/FAT file systems. If there is, I don't have to compute them all to search my file.
If there is, how to access it using .NET?
If it helps, it will be JPEG files. Do they have a checksum?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没有这样的事情。
There is no such thing.
Windows 不存储每个文件的哈希值。正如 Jader Dias 所建议的,EXE 和 DLL 有校验和,但这些不是您正在寻找的机器人。
请注意,即使您有这样的哈希值,它仍然不能保证唯一性。如果您发现两个文件具有相同的哈希值(和大小),您仍然需要比较内容以确定这些文件是否确实相同。
JPEG 文件可能有一些校验和或哈希值,但您可能也不能指望它们。
Windows does not store a hash for each file. As Jader Dias suggests, there are checksums for EXE's and DLL's but these are not the droids you are looking for.
Note that even if you had such a hash, it still does not guarantee uniqueness. If you found two files with the same hash (and size) you would still have to then compare contents to determine if the files were truly the same.
JPEG files may have some checksums or hashes, but you probably cannot count on them either.
Windows 现在确实有搜索功能如果我没记错的话,您可以为其编写自己的插件(换句话说,以自定义方式索引文件)。据推测,您可以为 JPG 和 JPG 编写一个插件。然后只需调用搜索 API 来查找文件(在 Windows 进行索引之后)。
Windows though does have search now & if I recall correctly you can write your own plugins for it (in other words, to index files in a custom way). Presumably, you could write a plugin for JPGs & then simply make search API calls to find files (after Windows does the indexing).