Welcome. Which distro?
Double check the working directory which the script is using, it sounds like it may be different. Use
cd and
pwd for that.
If you are doing a bulk rename, you might see if the
prename version of
rename is on your system.
Code:
prename -n 's/^file([0-9]{2}).jpg/newfile$1.jpg/' file*.jpg
man prename
It is the perl variant of that utility and can take
any perl expression, not just regular expressions. So you can count or add or whatever as part of the renaming.