copying a file from one dir to another dir

hi
i have a script

compareFiles()
{
find /tmp/Satya -type f | \
while read filename1
do
echo "----------------------------------------$filename1"
   find /tmp/Satya -type f | \
   while read filename2
   do
      if diff $filename1 $filename2
        then
            echo "Both files are same"
      else
               cp /tmp/Satya/$filename1  /tmp/Satya/CGTPatterns/$filename1
        fi
   done
done

}
compareFiles

i am not able to copy the file i am getting an error
cp: cannot stat `/tmp/Satya//tmp/Satya/11.File': No such file or directory

please help its urgent

cp: cannot stat `/tmp/Satya//tmp/Satya/11.File': No such file or directory

See the /tmp/Satya/11.File in the above - that is the return from your find command. You will need to
(a) modify your copy command to adjust for the full path
or
(b) strip out for just the filename after you "find" your files

There's no need for a slash after the pipe.

Do you really want the output of diff to show on your screen?

If not, redirect the output of diff to /dev/null.

You can just supply the destination directory as you are not changing the filename:

cp "/tmp/Satya/$filename1"  /tmp/Satya/CGTPatterns/

agree. i changed this...