The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Renaming multiple files jayell Shell Programming and Scripting 5 02-27-2008 12:17 PM
Moving multiple files and renaming them on the fly daemongk Shell Programming and Scripting 1 06-08-2007 10:36 AM
moving and renaming multiple files rocinante Shell Programming and Scripting 1 06-07-2007 05:20 PM
Renaming multiple files rmayur UNIX for Dummies Questions & Answers 6 02-26-2004 12:40 AM
Renaming multiple files jxh461 Shell Programming and Scripting 4 04-01-2003 03:25 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-09-2001
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
renaming multiple files

Hi to everyone!!. Here's my stupid question of the day.
When I have to rename a file I use "mv filename newfilename".
But what about renaming multiple files, for example if I want to add the prefix "old" to several image files (in fact it's what I wanted to do..).

Thanks in advance....
Forum Sponsor
  #2 (permalink)  
Old 11-09-2001
Registered User
 

Join Date: Feb 2001
Location: Sweden
Posts: 13
renaming files

hi

maybe 'rename' is what you're looking for.

e.g. $ rename .c .cc *.c

this would rename all your *.c files to
have the extension .cc

/*ghost*/
__________________
enjoy life...
  #3 (permalink)  
Old 11-09-2001
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
missing rename

Thank you but I don't have that command on Solaris 8.
I downloaded the file from Freshmeat, a script that works with the tr command but still doesn't work.

Still searching..... ..... ...... .....
  #4 (permalink)  
Old 11-09-2001
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,355
Re: missing rename

Quote:
Originally posted by piltrafa
Still searching..... ..... ...... .....
You might try searching this very site.

File name extensions
  #5 (permalink)  
Old 11-09-2001
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
almost...

Thanks for the suggestion. I tested your script and it works fine. The thing is that I want to change the files in thie way:

oldfile.txt to newfile.txt

I tried to change your script to make it work but, cause I'm not a scripter ( I don't know how to do it ), the new script fail.

thanks again for you help.
  #6 (permalink)  
Old 11-09-2001
Registered User
 

Join Date: Oct 2001
Location: Thailand
Posts: 4
Red face

Well, why not just play around with fore loop?

If you are in the same directory where you have your multiple files:

for foobar in * ; do mv $foobar old$foobar ; done

Simple, isn't it?

- OG
  #7 (permalink)  
Old 11-10-2001
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
EXCELLENT

It's just what I need, works exactly how I wanted and best of all, ITS SIMPLE....

Thanks a lot.
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0