rdfind 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

rdfind 命令安装:


-bash/zsh: rdfind: command not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install rdfind

# Debian
apt-get install rdfind

# Ubuntu
apt-get install rdfind

# Alpine
apk add rdfind

# Kali Linux
apt-get install rdfind

# Fedora
dnf install rdfind

# OS X
brew install rdfind

# Raspbian
apt-get install rdfind

# AUS - Arch
yay -S rdfind

# CentOS
sudo yum install epel-release
sudo yum install rdfind

# Dockerfile
dockerfile.run/rdfind

# Docker
docker run cmd.cat/rdfind rdfind

rdfind 命令补充说明:


Rdfind 是一个查找重复文件的程序。 它对于压缩备份目录或只是查找重复文件很有用。 它根据文件内容而不是文件名来比较文件。Rdfind 使用排序算法来区分原始文件和重复文件。如果你有两个或者更多的相同文件,Rdfind 会很智能的找到原始文件并认定剩下的文件为重复文件。一旦找到副本文件,它会向你报告。你可以决定是删除还是使用硬链接或者符号(软)链接代替它们。

截至 2018-03-26,rdfind 存储库已移至 Github。 可以使用 GitHub issues 进行错误报告、功能请求等。

rdfind 命令语法:


rdfind [options] directory_or_file_1 [directory_or_file_2] [directory_or_file_3] ...

rdfind 命令选项:


=========================================================================
Searching options etc:

-ignoreempty true|false
Ignore empty files. Setting this to true (the default) is equivalent to -minsize 1, false is equivalent to -minsize 0.

-minsize N
Ignores files with less than N bytes. Default is 1, meaning empty files are ignored.

-maxsize N
Ignores files with N bytes or more. Default is 0, which means this check is disabled.

-followsymlinks true|false
Follow symlinks. Default is false.

-removeidentinode true|false
Removes items found which have identical inode and device ID. Default is true.

-checksum md5|sha1|sha256|sha512
What type of checksum to be used: md5, sha1, sha256 or sha512. The default is sha1 since version 1.4.0.

-deterministic true|false
If set (the default), sort files of equal rank in an unspecified but deterministic order. This makes the behaviour independent of in which order files are listed when querying the file system.

=========================================================================
Action options:

-makesymlinks true|false
Replace duplicate files with symbolic links. Default is false.

-makehardlinks true|false
Replace duplicate files with hard links. Default is false.

-makeresultsfile true|false
Make a results file in the current directory. Default is true. If the file exists, it is overwritten. This does not affect whether items are deleted. See -dryrun for how to disable deletions.

-outputname name
Make the results file name to be "name" instead of the default results.txt.

-deleteduplicates true|false
Delete (unlink) files. Default is false.

=========================================================================
General options:

-sleep Xms
Sleeps X milliseconds between reading each file, to reduce load. Default is 0 (no sleep). Note that only a few values are supported at present: 0,1-5,10,25,50,100 milliseconds.

-n, -dryrun true|false
Displays what should have been done, don't actually delete or link anything. Default is false.

-h, -help, --help
Displays a brief help message.

-v, -version, --version
Displays the version number.

rdfind 命令参数:


目标文件、目录

rdfind 命令实例:


rdfind 识别给定目录中的所有重复项并输出摘要:

rdfind -dryrun true path/to/directory

rdfind 基本示例,在目录 /home/pauls/bilder 中查找重复文件:

$ rdfind /home/pauls/bilder/

Now scanning "/home/pauls/bilder", found 3301 files.
Now have 3301 files in total.

Removed 0 files due to nonunique device and inode.
Now removing files with zero size...removed 3 files

Total size is 2861229059 bytes or 3 Gib

Now sorting on size:removed 3176 files due to unique sizes.122 files left.
Now eliminating candidates based on first bytes:removed 8 files.114 files left.
Now eliminating candidates based on last bytes:removed 12 files.102 files left.
Now eliminating candidates based on md5 checksum:removed 2 files.100 files left.

It seems like you have 100 files that are not unique

Totally, 24 Mib can be reduced.

Now making results file results.txt

rdfind 用硬链接替换所有重复项:

rdfind -makehardlinks true path/to/directory

rdfind 用 符号链接 / 软链接 替换所有重复项:

rdfind -makesymlinks true path/to/directory

rdfind 删除所有重复项并且不要忽略空文件:

rdfind -deleteduplicates true -ignoreempty false path/to/directory

rdfind 扩展阅读:




rdfind 命令评论