Solved

Rename large number of files

Posted on 2006-06-23
3
277 Views
Last Modified: 2010-04-21
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.  
0
Comment
Question by:devildog1775
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 45

Accepted Solution

by:
Kent Olsen earned 500 total points
ID: 16973036

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
 

Author Comment

by:devildog1775
ID: 16973133
and even one line... :-) tks
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 16975174
Hi devildog1775,
> and even one line... :-) tks

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


Kent
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question