Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: find duplicate files
On 4/6/19 7:44 AM, Emanuel Berg wrote:
> Paul Hoffman wrote:
>
>> #!/bin/zsh
>> find-duplicates () {
>> (( # > 0 )) || set -- *(.N)
>> local dups=0
>> md5sum $@ | sort | uniq -c |
>> grep -qv '^ *1 ' | wc -l | read dups
>> (( dups == 0 )) && echo "no duplicates"
>> }
>
> Cool, but doesn't seem to work?
>
Forgot to ignore the second field.
#!/bin/zsh
find-duplicates () {
(( # > 0 )) || set -- *(.N)
local dups=0
md5sum $@ | sort | awk '{ print $2,$1 }' | uniq -c -f1 | \
grep -v '^ *1 ' | wc -l | read dups
(( dups == 0 )) && echo "no duplicates"
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author