From d8fe4b3bb681d4452a4911b5f480531e07239b1d Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 24 Aug 2019 20:05:45 +0530 Subject: Plugin dups: find duplicate files in dir --- plugins/dups | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 plugins/dups (limited to 'plugins/dups') diff --git a/plugins/dups b/plugins/dups new file mode 100755 index 0000000..0643025 --- /dev/null +++ b/plugins/dups @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# Description: List non-empty duplicate files in the current directory (based on size followed by MD5) +# +# Source: https://www.commandlinefu.com/commands/view/3555/find-duplicate-files-based-on-size-first-then-md5-hash +# +# Requires: find md5sum sort uniq xargs +# +# Shell: POSIX compliant +# Author: syssyphus + +find -size +0 -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate + +echo "Press any key to exit" +read dummy -- cgit v1.2.3-70-g09d2