What are "duplicate" files for you? Files with the same basename? Or with with identical contents?
It seems that you are using too many hashes, that are initialized nowhere: %hash is used but never declared, %path_file used and neither declared nor initialized.
Comment on Re: Recursive search for duplicate files