find-dupes-dired: 寻找重复文件,并用dired方式处理

基于外部命令 jdupes (windows) 或 fdupes (LInux),将结果组织到一个dired buffer中,方便处理,界面与find-dired类似

Linux 下的 fdupes 是一个非常好用的命令,尤其是整理相片,文档等很多名称不一样,但是内容一样的文件时。


运行find-dupes-dired后让输入参数,不输入或输入-r都提示 “wrong type argument stringp nil”, 不知道要怎么调用。

我这边emacs 28 snapshot, windows + jdupes或者manjaro+fdupes,都没有问题。

-r 是默认带的参数,可以不输入。 如果没有额外的参数需要输入,直接回车即可

Emacs 版本? fdupes 或 jdupes 在路径里边吗?

emacs 27.1, 用的doom emacs的配置,fdupes可以在iTerm2中使用。

新增了一个粗略的debug message,等更新后(setq find-dupes-dired-verbose t),可以在*message*里看看输出

locate-file: Wrong type argument: stringp, nil

开了find-dupes-dired-verbose之后,在message buffer里会有类似于下边的输出

find-dupes-dired-program: jdupes
dir: "xxx"
command line: jdupes  -r "xxx" -0 | xargs -0 ls -lUd


我这里没有emacs 27,所以没法调试。


如果message buffer里没有相关内容的话,就是一开始就出错了,(executable-find "fdupes")能找到fdupes?

再多我也无能为力了 :sweat_smile:

(executable-find "fdupes") 可以找到,输出“/usr/local/bin/fdupes”。mac是不是需要额外配置啊。


(setq find-dupes-dired-program (executable-find "fdupes"))
(setq find-dupes-dired-ls-option '("-q | xargs -d \"\\n\" ls -dilsbU" . "-dilsbU"))


  /usr/local/bin/fdupes  -r /Users/sfq/ -q | xargs -d "\n" ls -dilsbU
  xargs: illegal option --        d
  usage: xargs [-0opt] [-E  eofstr] [-I replstr [-R replacements] [-S replsize]]
               [-J replstr] [-L number]      [-n number [-x]] [-P maxprocs]
               [-s size] [utility [argument    ...]]
  -d, --delimiter=CHARACTER    items in input stream are separated by CHARACTER,
                                 not by whitespace; disables quote and backslash
                                 processing and logical EOF processing



Usage: fdupes [options] DIRECTORY...

 -r --recurse            for every directory given follow subdirectories
                         encountered within
 -R --recurse:           for each directory given after this option follow
                         subdirectories encountered within (note the ':' at the
                         end of the option, manpage for more details)
 -s --symlinks           follow symlinks
 -H --hardlinks          normally, when two or more files point to the same
                         disk area they are treated as non-duplicates; this
                         option will change this behavior
 -G --minsize=SIZE       consider only files greater than or equal to SIZE bytes
 -L --maxsize=SIZE       consider only files less than or equal to SIZE bytes
 -n --noempty            exclude zero-length files from consideration
 -A --nohidden           exclude hidden files from consideration
 -f --omitfirst          omit the first file in each set of matches
 -1 --sameline           list each set of matches on a single line
 -S --size               show size of duplicate files
 -t --time               show modification time of duplicate files
 -m --summarize          summarize dupe information
 -q --quiet              hide progress indicator
 -d --delete             prompt user for files to preserve and delete all
                         others; important: under particular circumstances,
                         data may be lost when using this option together
                         with -s or --symlinks, or when specifying a
                         particular directory more than once; refer to the
                         fdupes documentation for additional information
 -P --plain              with --delete, use line-based prompt (as with older
                         versions of fdupes) instead of screen-mode interface
 -N --noprompt           together with --delete, preserve the first file in
                         each set of duplicates and delete the rest without
                         prompting the user
 -I --immediate          delete duplicates as they are encountered, without
                         grouping into sets; implies --noprompt
 -p --permissions        don't consider files with different owner/group or
                         permission bits as duplicates
 -o --order=BY           select sort order for output and deleting; by file
                         modification time (BY='time'; default), status
                         change time (BY='ctime'), or filename (BY='name')
 -i --reverse            reverse order while sorting
 -l --log=LOGFILE        log file deletion choices to LOGFILE
 -v --version            display fdupes version
 -h --help               display this help message


usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements] [-S replsize]]
             [-J replstr] [-L number] [-n number [-x]] [-P maxprocs]
             [-s size] [utility [argument ...]]