renaming multiple files while replacing string

hi,

i've found a few examples of scripts to do this but for some reason can't get them to work properly.

basically i have some dirs with a few hundred files mixed in with a bunch of other files that were made with a typo in part of them.

long-file-names-tyo-example.ext

want to be able to run something through the dir and rename every file with 'tyo' in the file name to the correct 'typo' string

long-file-names-typo-example.ext

any help would be greatly appreciated.

for files in *tyo*.ext
do
  mv "$files" "${files/tyo/typo}"
done 

thank you very much, this worked great.