你可以在 dryrun 模式中运行这个命令 (换句话说,仅仅汇报可能会另外被做出的改动)。
$ rdfind -dryrun true ~ (DRYRUN MODE) Now scanning "/home/shark", found 12 files. (DRYRUN MODE) Now have 12 files in total. (DRYRUN MODE) Removed 1 files due to nonunique device and inode. (DRYRUN MODE) Total size is 699352 bytes or 683 KiB Removed 9 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 sha1 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, 223 KiB can be reduced. (DRYRUN MODE) Now making results file results.txt
rdfind 命令同样提供了类似忽略空文档(-ignoreempty )和跟踪符号链接(-followsymlinks )的功能。查看 man 页面获取解释。
-ignoreempty ignore empty files -minsize ignore files smaller than speficied size -followsymlinks follow symbolic links -removeidentinode remove files referring to identical inode -checksum identify checksum type to be used -deterministic determiness how to sort files -makesymlinks turn duplicate files into symbolic links -makehardlinks replace duplicate files with hard links -makeresultsfile create a results file in the current directory -outputname provide name for results file -deleteduplicates delete/unlink duplicate files -sleep set sleep time between reading files (milliseconds) -n, -dryrun display what would have been done, but don't do it
注意 rdfind 命令提供了 -deleteduplicates true 的设置选项以删除副本。希望这个命令语法上的小问题不会惹恼你。;-)
$ rdfind -deleteduplicates true . ... Deleted 1 files. <==
你将可能需要在你的系统上安装 rdfind 命令。试验它以熟悉如何使用它可能是一个好主意。
使用 fdupes 命令
fdupes 命令同样使得识别重复文件变得简单。它同时提供了大量有用的选项——例如用来迭代的 -r 。在这个例子中,它像这样将重复文件分组到一起:
$ fdupes ~ /home/shs/UPGRADE /home/shs/mytwin -
/home/shs/lp.txt /home/shs/lp.man -
/home/shs/penguin.png /home/shs/penguin0.png /home/shs/hideme.png
这是使用迭代的一个例子,注意许多重复文件是重要的(用户的 .bashrc 和 .profile 文件)并且不应被删除。
# fdupes -r /home /home/shark/home.html /home/shark/index.html -
/home/dory/.bashrc /home/eel/.bashrc -
/home/nemo/.profile /home/dory/.profile /home/shark/.profile -
/home/nemo/tryme /home/shs/tryme -
/home/shs/arrow.png /home/shs/PNGs/arrow.png -
/home/shs/11/files_11.zip /home/shs/ERIC/file_11.zip -
/home/shs/penguin0.jpg /home/shs/PNGs/penguin.jpg /home/shs/PNGs/penguin0.jpg -
/home/shs/Sandra_rotated.png /home/shs/PNGs/Sandra_rotated.png
(编辑:ASP站长网)
|