mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-12-02 12:18:41 -05:00
16 lines
592 B
Plaintext
16 lines
592 B
Plaintext
|
#!/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
|
||
|
#
|
||
|
# Dependencies: find md5sum sort uniq xargs
|
||
|
#
|
||
|
# Shell: POSIX compliant
|
||
|
# Authors: syssyphus, KlzXS
|
||
|
|
||
|
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
|
||
|
|
||
|
printf "Press any key to exit"
|
||
|
read -r _
|