2019-08-24 20:05:45 +05:30
|
|
|
#!/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
|
|
|
|
#
|
2020-05-06 10:59:57 +05:30
|
|
|
# Dependencies: find md5sum sort uniq xargs
|
2019-08-24 20:05:45 +05:30
|
|
|
#
|
|
|
|
# Shell: POSIX compliant
|
2020-05-06 10:42:29 +05:30
|
|
|
# Authors: syssyphus, KlzXS
|
2019-08-24 20:05:45 +05:30
|
|
|
|
2020-04-26 18:55:03 +02:00
|
|
|
find . -size +0 -type f -printf "%s %p\n" | sort -rn | sed -n 'N; /^\([0-9]*\) .*\n\1.*$/p;$d;D' | awk '{printf("%s\0", substr($0, index($0, $2)))}' | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
|
2019-08-24 20:05:45 +05:30
|
|
|
|
2019-11-22 02:14:25 +05:30
|
|
|
printf "Press any key to exit"
|
|
|
|
read -r _
|