The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 7 01-12-2009 04:27 PM
Moving multiple files and renaming them on the fly daemongk Shell Programming and Scripting 1 06-08-2007 01:36 PM
moving and renaming multiple files rocinante Shell Programming and Scripting 1 06-07-2007 08:20 PM
Renaming multiple files rmayur UNIX for Dummies Questions & Answers 6 02-26-2004 04:40 AM
Renaming multiple files jxh461 Shell Programming and Scripting 4 04-01-2003 06:25 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-09-2001
piltrafa's Avatar
piltrafa piltrafa is offline
Registered User
  
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 77
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....
  #2 (permalink)  
Old 11-09-2001
ghost ghost is offline
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*/
  #3 (permalink)  
Old 11-09-2001
piltrafa's Avatar
piltrafa piltrafa is offline
Registered User
  
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 77
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
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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
piltrafa piltrafa is offline
Registered User
  
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 77
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
old_geezer old_geezer is offline
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
piltrafa piltrafa is offline
Registered User
  
 

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

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

Thanks a lot.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0