Answers:
我知道Linux的4种命令行解决方案。rdfind
由于所有可用的选项,我首选的是这里列出的最后一个。
杜拜
样本输出(带有“显示大小”,“递归”选项):
$ fdupes -Sr .
17 bytes each:
./Dir1/Some File
./Dir2/SomeFile
硬链接
--dry-run
选择。 示例输出(请注意我的两个文件的修改时间略有不同,因此在第二次运行中,我告诉它忽略它):
$ stat Dir*/* | grep Modify
Modify: 2015-09-06 23:51:38.784637949 -0500
Modify: 2015-09-06 23:51:47.488638188 -0500
$ hardlink --dry-run -v .
Mode: dry-run
Files: 5
Linked: 0 files
Compared: 0 files
Saved: 0 bytes
Duration: 0.00 seconds
$ hardlink --dry-run -v -t .
[DryRun] Linking ./Dir2/SomeFile to ./Dir1/Some File (-17 bytes)
Mode: dry-run
Files: 5
Linked: 1 files
Compared: 1 files
Saved: 17 bytes
Duration: 0.00 seconds
达芙
样本输出(带有“递归”选项):
$ duff -r .
2 files in cluster 1 (17 bytes, digest 34e744e5268c613316756c679143890df3675cbb)
./Dir2/SomeFile
./Dir1/Some File
rdfind
find
吗?)。样本输出:
$ rdfind -dryrun true -makehardlinks true .
(DRYRUN MODE) Now scanning ".", found 5 files.
(DRYRUN MODE) Now have 5 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 0 files
(DRYRUN MODE) Total size is 13341 bytes or 13 kib
(DRYRUN MODE) Now sorting on size:removed 3 files due to unique sizes from list.2 files left.
(DRYRUN MODE) Now eliminating candidates based on first bytes:removed 0 files from list.2 files left.
(DRYRUN MODE) Now eliminating candidates based on last bytes:removed 0 files from list.2 files left.
(DRYRUN MODE) Now eliminating candidates based on md5 checksum:removed 0 files from list.2 files left.
(DRYRUN MODE) It seems like you have 2 files that are not unique
(DRYRUN MODE) Totally, 17 b can be reduced.
(DRYRUN MODE) Now making results file results.txt
(DRYRUN MODE) Now making hard links.
hardlink ./Dir1/Some File to ./Dir2/SomeFile
Making 1 links.
$ cat results.txt
# Automatically generated
# duptype id depth size device inode priority name
DUPTYPE_FIRST_OCCURRENCE 1 1 17 2055 24916405 1 ./Dir2/SomeFile
DUPTYPE_WITHIN_SAME_TREE -1 1 17 2055 24916406 1 ./Dir1/Some File
# end of file
在Windows上, Duplicate Commander是一种可能的解决方案:
Duplicate Commander是一个免费的应用程序,可让您在PC上查找和管理重复文件。Duplicate Commander具有许多功能和工具,可让您从这些重复项中恢复磁盘空间。
特征:
Replacing files with hard links Replacing files with soft links ... (and many more) ...
对于Linux,您可以在这里找到Bash脚本。
Windows中的“ 重复和相同文件搜索器”是另一种解决方案:
重复和相同文件搜索器(Duplicate Searcher)是用于搜索重复文件(克隆)和指向同一文件的NTFS硬链接的应用程序。它搜索重复的文件内容,而不管文件名如何(使用真正的字节对字节比较)。此应用程序不仅允许删除重复的文件或将其移动到其他位置,还可以用NTFS硬链接替换重复的文件(唯一!)。
我强烈推荐jdupes。它是fdupes的增强型分支,还包括:
--linkhard
或-L
简称对于您的问题,您可以执行$ jdupes -L /path/to/your/files
。
由于该项目仍在积极开发中,因此您可能想从其GitHub存储库中克隆并构建最新资源。
Windows二进制文件也在此处提供。打包的二进制文件在某些Linux / BSD发行版中可用-实际上我是通过第一次发现它的$ apt search
。