ChaotiCc

Untitled

May 21st, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. # Arg 1: directory
  2. function rechercheCopie {
  3.     echo "Searching directory `(cd $1 && pwd)`..."
  4.     files=(`find $1 -type f 2> /dev/null`)
  5.     echo "${#files[*]} files"
  6.  
  7.     i=0
  8.  
  9.     while [ $i -lt ${#files[*]} ]; do
  10.         file1=${files[$i]}
  11.         j=$((i+1))
  12.  
  13.         while [ $j -lt ${#files[*]} ]; do
  14.             file2=${files[$j]}
  15.  
  16.             if [ $i != $j ]; then
  17.                 firstMd5=`md5 -q "$file1"`
  18.                 secondMd5=`md5 -q "$file2"`
  19.  
  20.                 if [ "$firstMd5" = "$secondMd5" ]; then
  21.                     echo -e "$file1\t$file2"
  22.                 fi
  23.  
  24.             fi
  25.             ((j++))
  26.         done
  27.  
  28.         ((i++))
  29.     done
  30. }
Advertisement
Add Comment
Please, Sign In to add comment