重复的文件查找器 [英] Duplicate file finder

查看:79
本文介绍了重复的文件查找器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的家伙.......



我想找到并处理我系统中的所有重复文件。



我应该使用逐字节比较文件。但问题是我想用目录,文件夹和子文件夹中的其他文件搜索每个文件。如何查找和列出文件夹及其子文件夹层次结构中的所有文件。



请给我一个想法,在我的目录树中找到重复的文件。

如果可能的话,给我一个想法和代码如果你们有...



关于



Irfad C

Dear Guys.......

i want to find and process all duplicate files in my system.

i supposed to use byte by byte comparison of files. but here the problem is i want to search each files with other files in a directory,folder and sub folders. how to find and list all files in a folder and its sub folder hierarchy.

please give me an idea to find duplicate files in my directory tree.
if possible give me the idea and code if you guys have...

With regards

Irfad C

推荐答案

以下是你应该做的事情:

Here is the idea of what you should do:


  1. 使用 DirectoryInfo [ ^ ]遍历文件系统结构。
  2. 将找到的所有文件及其完整路径添加到列表中,确保不要多次添加同一文件。
  3. 计算 MD5哈希 [ ^ ]对于每个人的内容d列表中的每个文件,并将该值与文件路径一起存储。 (也许 SHA-2 [ ^ ])
  4. 将所有文件分区为集合,以便任何两个文件都在一个集合中,当且仅当它们的MD5或SHA-2哈希是
  5. 对于每个集合,对该集合中的所有文件进行二进制比较。

  1. Use the class DirectoryInfo[^] to traverse the file system structure.
  2. Add all files found with their complete path to a list making sure not to add the same file more than once.
  3. Calculate the MD5 hash[^] for the content of each and every file in your list and store that value along with the files path. (maybe SHA-2[^])
  4. Partition all files into sets so that any two files will be in one set if and only if their MD5 or SHA-2 hashes are identical.
  5. For each set do a binary compare of all files in that set against each other.





此致,



-MRB


这将检索目录中所有文件的路径,包括子目录中的那些。



This will retrieve the paths of all files in a directory including those in sub directories.

string[] files = System.IO.Directory.GetFiles(
    "PathToDirectory", "*.*", System.IO.SearchOption.AllDirectories);


这篇关于重复的文件查找器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆