You are asking rename
to convert all the instances of [a-z]
to [A-Z]
. Instead, capture the desired string into a group and modify it:
rename 's/([^.]*)/\U$1/' foo_bar.ext
This would rename the file foo_bar.ext
to FOO_BAR.ext
.
If you have a file foo_bar.baz.ext
that needs to be renamed to FOO_BAR.BAZ.ext
, use greedy match and multiple groups. Saying:
rename 's/(.*)(\..*)/\U$1\E$2/' foo_bar.baz.ext
would rename the file foo_bar.baz.ext
to FOO_BAR.BAZ.ext
.