Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-20-2006, 02:25 PM   #1
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
linux shell gurus, need a command

I have directories:
- one/
- two/
- three/

each directory has images; aaa.jpg, aab.jpg, aac.jpg, etc..

i need to rename them so that I end up with:
one/one-aaa.jpg, one/one-aab.jpg, ...
two/two-aaa.jpg, two/two-aab.jpg, ...
three/three-aaa.jpg, three/three-aab.jpg, ...
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:27 PM   #2
dissipate
The Dirty Frenchman
 
dissipate's Avatar
 
Industry Role:
Join Date: Nov 2005
Location: Lost Angeles
Posts: 8,904
Gotta do that by hand bro, or write a shell script.
dissipate is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:28 PM   #3
Brad Mitchell
Confirmed User
 
Brad Mitchell's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Southfield, MI
Posts: 9,812
One of my techs says he can write you a script to do this very quickly if that is what you are asking for. We're happy to help, call 866-746-3674 and ask for Will.

Cheers,

Brad
__________________
President at MojoHost | brad at mojohost dot com | Skype MojoHostBrad
71 industry awards for hosting and professional excellence since 1999
Brad Mitchell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:32 PM   #4
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
The command 'rename' is on the server, but I'm not sure how to write the regexp in this format to get the job done.

Code:
For example, to rename all files matching "*.bak" to strip the extension, you might say

               rename 's/\.bak$//' *.bak

To translate uppercase names to lower, you'd use

               rename 'y/A-Z/a-z/' *
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:33 PM   #5
mrkris
Confirmed User
 
Join Date: May 2005
Posts: 2,737
This should be a good start ...
http://webxadmin.free.fr/article/she...o-lowe-135.php
__________________

PHP-MySQL-Rails | ICQ: 342500546

Last edited by mrkris; 03-20-2006 at 02:34 PM.. Reason: URL error
mrkris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:34 PM   #6
dodger21
Confirmed User
 
Join Date: Jan 2003
Location: Los Angeles
Posts: 2,680
rm -rf *
__________________
icq: 237055440
dodger21 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:36 PM   #7
StatsJunky
Confirmed User
 
Join Date: Aug 2005
Location: Checking My Stats
Posts: 639
Quote:
Originally Posted by dodger21
rm -rf *
__________________
erik AT suthnet.com
StatsJunky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:37 PM   #8
High Plains Drifter
Confirmed User
 
High Plains Drifter's Avatar
 
Join Date: Jun 2005
Location: ♠ ♣ ♥
Posts: 2,341
cd one/
for i in `ls`; do mv $i one-$i; done
cd two/
for i in `ls`; do mv $i two-$i; done
cd three/
for i in `ls`; do mv $i three-$i; done
__________________

Last edited by High Plains Drifter; 03-20-2006 at 02:40 PM..
High Plains Drifter is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:43 PM   #9
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
Quote:
Originally Posted by dodger21
rm -rf *
I can't find all my images or directories now. Did it work ? I had just spent a few hours uploading about 15,000 images and sorting in appropriate directories. Did it put them somewhere else?
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:45 PM   #10
mrkris
Confirmed User
 
Join Date: May 2005
Posts: 2,737
Please tell me you're joking about running that command ...
__________________

PHP-MySQL-Rails | ICQ: 342500546
mrkris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:46 PM   #11
BoNgHiTtA
Confirmed User
 
Join Date: May 2003
Location: Seattle
Posts: 2,176
LOL my god thats hilarious
BoNgHiTtA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:47 PM   #12
Evil Doer
Confirmed User
 
Join Date: Dec 2004
Location: ICQ: 251-911-362
Posts: 915
Quote:
Originally Posted by Brujah
I can't find all my images or directories now. Did it work ? I had just spent a few hours uploading about 15,000 images and sorting in appropriate directories. Did it put them somewhere else?

__________________
see sig above mine
Evil Doer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:55 PM   #13
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
omg i feel sick
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 02:58 PM   #14
uno
RIP Dodger. BEST.CAT.EVER
 
uno's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: NYC Area
Posts: 18,450
Quote:
Originally Posted by mrkris
Please tell me you're joking about running that command ...
Please tell me you're not dumb enough to believe he actually did that.
__________________
-uno
icq: 111-914
CrazyBabe.com - porn art
MojoHost - For all your hosting needs, present and future. Tell them I sent ya!
uno is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 03:07 PM   #15
drjones
Confirmed User
 
Join Date: Oct 2005
Location: Charlotte, NC
Posts: 908
first thing you need to do anytime you take advice from a forum like this or even write a script to do potentially destructive things on your filesystem is to backup everything first!!!!!!!!!!!!!!

cp -r images_directory/ backup_images_directory/

Then experiment with it all you want. Look on the brightside.. at least he didnt tell you to 'rm -rf /'. Then youd really be in trouble.
drjones is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 03:46 PM   #16
mrkris
Confirmed User
 
Join Date: May 2005
Posts: 2,737
Quote:
Originally Posted by uno
Please tell me you're not dumb enough to believe he actually did that.
In my field you have no idea how many people fall for that heh.
__________________

PHP-MySQL-Rails | ICQ: 342500546
mrkris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 04:15 PM   #17
Brad Mitchell
Confirmed User
 
Brad Mitchell's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Southfield, MI
Posts: 9,812
You didn't really run that command did you? Nah, couldn't have..

Brad
__________________
President at MojoHost | brad at mojohost dot com | Skype MojoHostBrad
71 industry awards for hosting and professional excellence since 1999
Brad Mitchell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 05:09 PM   #18
Why
MFBA
 
Industry Role:
Join Date: Mar 2003
Location: PNW
Posts: 7,230
Quote:
Originally Posted by High Plains Drifter
cd one/
for i in `ls`; do mv $i one-$i; done
cd two/
for i in `ls`; do mv $i two-$i; done
cd three/
for i in `ls`; do mv $i three-$i; done
this would work the best i think, of the answers posted so far.

call brad his techs are good at what they do. done some cool stuff for us
Why is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 07:55 PM   #19
High Plains Drifter
Confirmed User
 
High Plains Drifter's Avatar
 
Join Date: Jun 2005
Location: ♠ ♣ ♥
Posts: 2,341
Quote:
Originally Posted by Why
this would work the best i think, of the answers posted so far.
phew... I knew that System V for Idiots book would come in handy eventually.
__________________
High Plains Drifter is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2006, 09:03 PM   #20
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
thanks, got it tackled and appreciate the tips.
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.