Replace all occurances of a string in all file-/foldernames, recursively

I need a script that will replace all occurances of a string in all filenames and foldernames, recursively.

Right now I have this script:

for f in `find -name *eye*`; do
  echo processing $f
  g=`expr "xxx$f" : 'xxx\(.*\)' | tr 'eye' 'm'`
  mv "$f" "$g"
done

The problem is that tr replaces the characters e and y with m instead of the string "eye".

I adapted this from http://webxadmin.free.fr/article/shell-rename-all-files-in-subdirectories-to-lowe-135.php
so I don't really know what the regular expressions in expr are doing.

It is aggravating because I am so close, but I can't get it to work.

I had problems getting your script to work but here is one that does:

for f in `find . -name \*eye\* -print`; do
  echo processing $f
  g=`print "$f" | nawk 'gsub(/eye/,"m")'`
  mv "$f" "$g"
done

"tr" in the script that your link reference is simply changing upper case names to lower case.

Great, that script worked perfectly.
Thanks for the quick reply tmarikle.
-TheMJ