-
-
Save mjf/4327d98f714373ec6850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# fdups - Finds duplicated files in given path | |
# Copyright (C) 2019 Matouš Jan Fialka, <http://mjf.cz/> | |
# Released under the terms of "The MIT License" | |
FDUPS_SUMPROG="${FDUPS_SUMPROG:-sha512sum}" | |
fdups1() { | |
find "$1" ! -type d -printf '%s\n' | | |
sort -n | | |
uniq -d | | |
xargs -I@@ -n1 find "${1:-.}" -type f ! -size 0 -a -size @@c -exec "$FDUPS_SUMPROG" {} \; | | |
sort -k1,32 | | |
uniq -w32 -d --all-repeated=separate | | |
sed 's/^[^ ]\+ \+//' | |
} | |
for path in ${@:-.}; do | |
fdups1 "$path" | |
printf -- '\n' | |
done 2>/dev/null | |
# vi:ft=sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment