Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2006-01-30, 05:17 AM   #1
CelticTiger
Are you sure this is the Sci-Fi Convention? It's full of nerds!
 
CelticTiger's Avatar
 
Join Date: Feb 2004
Location: Ireland
Posts: 266
Send a message via ICQ to CelticTiger
Shell batch rename command/script

I'm hoping someone can help me figure out how to batch rename files recursively thru a directory on our server......ie I'd like to rename all files starting with "thumb_" to "tn_" leaving the remainder of the file name intact so that thumb_pic01.jpg would be renamed tn_pic01.jpg

Any help is greatly appreciated
__________________

Submissions Wanted!
CelticTiger is offline   Reply With Quote
Old 2006-01-30, 05:36 AM   #2
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
find . -name "thumb_*.jpg" -exec echo "mv '{}' '{}'" \; | sed 's/thumb_/tn_/2' | /bin/sh
swedguy is offline   Reply With Quote
Old 2006-01-30, 05:55 AM   #3
CelticTiger
Are you sure this is the Sci-Fi Convention? It's full of nerds!
 
CelticTiger's Avatar
 
Join Date: Feb 2004
Location: Ireland
Posts: 266
Send a message via ICQ to CelticTiger
Nice one swedeguy Thanks alot!
__________________

Submissions Wanted!
CelticTiger is offline   Reply With Quote
Old 2006-01-30, 06:44 AM   #4
Servhot
Kids are great, Appu. You can teach them to hate the things you hate and they practically raise themselves now-a-days, you know, with the internet and all
 
Servhot's Avatar
 
Join Date: Jan 2005
Location: Denmark
Posts: 199
Send a message via ICQ to Servhot Send a message via AIM to Servhot Send a message via Yahoo to Servhot
Also MMV is a very nice tool for the shell which can not rename only, you also can move files, folders etc.
__________________
Zappu

Adult Content Provider
Servhot is offline   Reply With Quote
Old 2006-01-31, 05:18 PM   #5
rtv
You can now put whatever you want in this space :)
 
Join Date: Jun 2004
Location: Europe
Posts: 670
Send a message via AIM to rtv Send a message via Yahoo to rtv
Quote:
Originally Posted by swedguy
find . -name "thumb_*.jpg" -exec echo "mv '{}' '{}'" \; | sed 's/thumb_/tn_/2' | /bin/sh

You're genius! I wish I knew this earlier!
rtv is offline   Reply With Quote
Reply


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

Forum Jump


All times are GMT -4. The time now is 02:47 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc