Rename large number of files

I need some help with a script to run on Solaris 10.  
I have approximetly 1000 files that are named myIMG.bmp.1 all the way to myIMG.bmp.1006.

I need to rename them all.

What I would like is someone to be able to rename for example myIMG.bmp.1 to 1.bmp.  

IMPORTANT
Also there are other files in the directory I don't want to rename any that do not end in a number.  
devildog1775Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Kent OlsenConnect With a Mentor Data Warehouse Architect / DBACommented:

This will generate a script that will do it for you:

 ls myIMG.bmp.*|awk '{print "mv " $1 " " $1}'|sed 's/myIMG.bmp.//2;s/$/.bmp/g'


And something similar could also be run through find.



Good Luck,
Kent
0
 
devildog1775Author Commented:
and even one line... :-) tks
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi devildog1775,
> and even one line... :-) tks

Why use two, when one will do?   :~}


Kent
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.