发现基于内容匹配的文件 [英] finding matching files based on content

查看:111
本文介绍了发现基于内容匹配的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须写比较两个目录,并认为基于内容不重复的文件名的文件的脚本。我想用diff命令,差异-r DIR1 DIR2的,但我得到一吨的不需要的信息,所以我的问题是,什么是找到基于文件而不是名称

解决方案

您可以使用哈希函数类似的 的md5sum 。如果哈希匹配,文件是相同的。

I have to write a script that compares two directories and finds duplicate files based on content not filename. I was thinking of using the diff command, diff -r dir1 dir2, but I get a ton of unwanted information, so my question is, what is the best way to find matching files based on the contents of the file not the name

解决方案

You could use a hash function like md5sum. If the hashes match, the files are identical.

这篇关于发现基于内容匹配的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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