Return to Snippet

Revision: 69416
at June 16, 2015 11:56 by brm


Initial Code
#!/bin/sh

find "$@" -type f -print0 | xargs -0 md5sum | sort | perl -ne

'chomp;$x=$y;($y,$z)=split(/\s+/,$_,2); print "$z"."\x00" if ($x eq $y)' | xargs -0 rm -v --

#OR
#if wanna find out size of all files to calculate space storage 
#change the 
# xargs -0 stat -c %s | awk'{SUM+=$1}END{print SUM/1024/1024}'

Initial URL


Initial Description
Perl 1 liner + additional linux command to find duplicate files and remove it - only spare 1 file.

Initial Title
Find duplicate file and remove

Initial Tags


Initial Language
Bash