Script to move duplicate files
Due to reasons too boring and embarrassing to relate I have lots of duplicate files. I found this script on line
Code:
find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate| cut -f3-100 -d ' ' | tr '\n.' '\t.' | sed 's/\t\t/\n/g' | cut -f2-100 | tr '\t' '\n' | perl -i -pe 's/([ (){}-])/\\$1/g' | perl -i -pe 's/'\''/\\'\''/g' | xargs -pr rm -v I tried Code:
find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate| cut -f3-100 -d ' ' | tr '\n.' '\t.' | sed 's/\t\t/\n/g' | cut -f2-100 | tr '\t' '\n' | perl -i -pe 's/([ (){}-])/\\$1/g' | perl -i -pe 's/'\''/\\'\''/g' | xargs -pr rm -v Code:
mv: cannot overwrite non-directory `./test2.txt' with directory `duplicates/' ---------- Post added 04-07-13 at 04:05 PM ---------- Solved it I needed to put the full path to the duplicate directory!!! |
this is an extremely inefficient solution, there are tools to do it, for example: http://www.junauza.com/2010/01/how-t...duplicate.html
|
All times are GMT -5. The time now is 10:03 PM. |