小编Sim*_*lGy的帖子

在 OSX Lion 中使用命令行对文件进行重复数据删除

我使用的是 OSX 10.8.4,并且希望在 md5 哈希匹配的情况下删除单个平面目录中的重复文件。

我查找了几个答案,但没有一个对我有用,我认为这是因为终端版本之间的命令语法存在差异。

我尝试过的事情:

http://www.chriswrites.com/2012/02/how-to-find-and-delete-duplicate-files-in-mac-os-x/

使用脚本查找并删除 osx 中的重复文件

其中一些: http: //www.commandlinefu.com/commands/view/3555/find-duplicate-files-based-on-size-first-then-md5-hash#comment

这种方法感觉最接近:

find . -size 20 \! -type d -exec cksum {} \; | sort | tee /tmp/f.tmp | cut -f 1,2 -d ' ' | uniq -d | grep -hif - /tmp/f.tmp > duplicates.txt
Run Code Online (Sandbox Code Playgroud)

但我收到一个错误:grep: -: No such file or directory

经检查,/tmp/f.tmp确实存在。duplicates.txt 文件已创建,但为空。

如何删除这些文件的重复数据?

deduplication command-line

4
推荐指数
1
解决办法
3003
查看次数

标签 统计

command-line ×1

deduplication ×1