in reply to renaming files

What you can do is do a grep(/\.TMB$/, readdir(THUMBS)) which will give you the list of thumbnail files. Then make sure you don't blow away existing files during your renaming function.

Quick Update: And use fundflow's regex for changing the name. (A clobber check is still advised. -e for a hint)