比较同一目录中的文件 [英] Compare files with each other within the same directory

查看:72
本文介绍了比较同一目录中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在一个目录中共有20个名为 file * .txt 的文件:

We have 20 files named as file*.txt all in one directory:

file1.txt
file2.txt
...
file20.txt

在同一目录中,我们还有其他文件,需要忽略:

In the same directory we have other files too, which we need to ignore:

someotherfile.csv
somemore.txt
etc.pdf

需要找出是否文件内容相同。尝试使用 diff ,显然失败了:

Need to find out if the contents of the files are the same. Tried to use diff, obviously failed:

diff -r ./file*.txt ./file*.txt`


推荐答案

如果您只是想要一个快速的视觉相同答案,我会使用;

If you just want a quick visual "are the same" answer, I'd use;

md5sum file*.txt

这篇关于比较同一目录中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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