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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Rename many files lmatlebyane Shell Programming and Scripting 9 04-30-2009 03:24 PM
Rename files cv313x Shell Programming and Scripting 2 03-31-2009 06:55 AM
rename a lot of files again ajp7701 Shell Programming and Scripting 11 03-31-2008 07:36 PM
rename files help piltrafa UNIX for Dummies Questions & Answers 2 10-04-2007 09:47 AM
How to rename files? CompuTelSystem UNIX for Dummies Questions & Answers 9 05-14-2002 03:28 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-27-2009
linuxaddict7 linuxaddict7 is offline
Registered User
  
 

Join Date: May 2008
Posts: 13
Rename files

Hi, I wanna rename bunch of files which has ":" to -.

ie. rename file named file1:file1 to file1-file1.

any ideas?
  #2 (permalink)  
Old 05-27-2009
edgarvm edgarvm is offline
Registered User
  
 

Join Date: May 2009
Posts: 20
i haven't tested this but it should work:
Code:
#!/bin/sh
dir=/tmp
for oldname in `find $tmp -type f`; do
   newname=`echo $oldname | tr ':' '-'`
   mv $oldname $newname
done

Last edited by edgarvm; 05-27-2009 at 09:47 AM.. Reason: indentation
  #3 (permalink)  
Old 05-27-2009
linuxaddict7 linuxaddict7 is offline
Registered User
  
 

Join Date: May 2008
Posts: 13
thank you. Worked great..!!
Sponsored Links
Reply

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 08:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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