Tuesday, March 14, 2017

Ubuntu find Duplicated Files

Try this

find -name "*.pdf" -printf "%10s\t%p\n" | sort --numeric | uniq --repeated --check-chars=10

or
Search similar filesize:

find -name "*" -printf "%sc %p\n" | sort --numeric | uniq --repeated --check-chars=10 | cut -d' ' -f1 | grep -v '0c' >a; for i in `cat a`; do echo $i; find -size $i; echo; done

to ignore the file type

for i in `cat a| uniq| sort -nr`; do echo $i; find -size $i | xargs -I{} echo \"{}\"| xargs md5sum 2>/dev/null; done

below code is the wrap up

find -name "*" -printf "%sc %p\n" |sort --numeric | uniq --repeated --check-chars=10 | cut -d' ' -f1 | grep -v '0c'> a
rm b.txt
for i in `cat a| uniq| sort -nr`; do echo $i; find -size $i| xargs -I{} echo \"{}\"| xargs md5sum >>b.txt 2>/dev/null; done
cat b.txt |sort --numeric | uniq --repeated --check-chars=10 > c.txt
cat c.txt | cut -d'*' -f1 >d
rm e
for i in `cat d`; do grep $i b.txt >> e;done


No comments:

Post a Comment