在一个文件夹(及其所有子文件夹)中查找具有相同内容的文件


1

假设我有一个名为container的文件夹,并且其中有许多文件/子文件夹。我想找到所有具有相同内容的文件(它们可以具有不同的名称,但是内容应该相同)。

有什么办法可以在Mac上执行此操作吗?


我将为目录层次结构中的所有文件计算md5校验和,并查找校验和重复项。
Nimesh Neema

Answers:


3

如果您习惯使用终端机,可以尝试rdfind准确地找到重复文件的目的。

您需要先使用Homebrew安装它:brew install rdfind

然后,假设您要对~/Download文件夹运行一次干测试:

rdfind -n true -outputname result.log ~/Downloads/
  • -n true 适用于干模式:不会影响任何文件
  • -outputname result.log 会将扫描结果输出到该文件
  • ~/Downloads/ 是您要扫描的根文件夹的参数(可以传递多个文件夹)

运行该命令将类似于以下内容:

$ rdfind -n true -outputname result.log ~/Downloads/
(DRYRUN MODE) Now scanning "/Users/ym/Downloads", found 20132 files.
(DRYRUN MODE) Now have 20132 files in total.
(DRYRUN MODE) Removed 0 files due to nonunique device and inode.
(DRYRUN MODE) Now removing files with zero size from list...removed 75 files
(DRYRUN MODE) Total size is 59782752628 bytes or 56 GiB
(DRYRUN MODE) Now sorting on size:removed 3795 files due to unique sizes from list.16262 files left.
(DRYRUN MODE) Now eliminating candidates based on first bytes:removed 579 files from list.15683 files left.
(DRYRUN MODE) Now eliminating candidates based on last bytes:removed 134 files from list.15549 files left.
(DRYRUN MODE) Now eliminating candidates based on md5 checksum:removed 94 files from list.15455 files left.
(DRYRUN MODE) It seems like you have 15455 files that are not unique
(DRYRUN MODE) Totally, 324 MiB can be reduced.
(DRYRUN MODE) Now making results file result.log

或者,您可以使用带有dupeguru之类图形界面的应用程序:

选择要扫描的文件夹

扫描结果

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.