I use fdupes
to list duplicate files. For example:
./topic/org-batch/.svn/pristine/45/45e578cf6c4723c6853b788e6ae35c1705fe9b19.svn-base
./topic/org-batch/Makefile
./topic/org-batch/lisp/sword-mode.el
./home/.emacs.d/lisp/sword-mode.el
./home/.emacs.d/lisp/sword-mode-bak.el
./topic/org-batch/.svn/pristine/2a/2a87de13f3959748235f2a9735b0d7da40ef8545.svn-base
./topic/org-batch/bin/orgmk-stow-orgmk.mk
./home/.emacs.d/elpa/auctex-12.1.1/COPYING
./home/.emacs.d/elpa/org-plus-contrib-20180813/COPYING
./topic/org-batch/.svn/pristine/1e/1ebac4e8f3174f5da74469ad0bf5714ed901233e.svn-base
./topic/org-batch/bin/orgmk-init
Though, some the above (the copies in SVN) are normal duplicate files.
Hence, I grep out those legitimate copies from .git
or .svn
directories:
fdupes -r . \
| grep -v "/.svn/" \
| grep -v "/.git/" \
| uniq
But I come with some isolated lines in the report:
./topic/org-batch/Makefile
./topic/org-batch/lisp/sword-mode.el
./home/.emacs.d/lisp/sword-mode.el
./home/.emacs.d/lisp/sword-mode-bak.el
./topic/org-batch/bin/orgmk-stow-orgmk.mk
./home/.emacs.d/elpa/auctex-12.1.1/COPYING
./home/.emacs.d/elpa/org-plus-contrib-20180813/COPYING
./topic/org-batch/bin/orgmk-init
for which I don't have to care about… as they're not copies I would have to delete.
How to remove those blocks made up of just one line?
Target report:
./topic/org-batch/lisp/sword-mode.el
./home/.emacs.d/lisp/sword-mode.el
./home/.emacs.d/lisp/sword-mode-bak.el
./home/.emacs.d/elpa/auctex-12.1.1/COPYING
./home/.emacs.d/elpa/org-plus-contrib-20180813/COPYING