GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   linux shell gurus, need a command (https://gfy.com/showthread.php?t=588810)

Brujah 03-20-2006 02:25 PM

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, ...

dissipate 03-20-2006 02:27 PM

Gotta do that by hand bro, or write a shell script.

Brad Mitchell 03-20-2006 02:28 PM

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

Brujah 03-20-2006 02:32 PM

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/' *


mrkris 03-20-2006 02:33 PM

This should be a good start ...
http://webxadmin.free.fr/article/she...o-lowe-135.php

dodger21 03-20-2006 02:34 PM

rm -rf * :winkwink:

StatsJunky 03-20-2006 02:36 PM

Quote:

Originally Posted by dodger21
rm -rf * :winkwink:

:1orglaugh

High Plains Drifter 03-20-2006 02:37 PM

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

Brujah 03-20-2006 02:43 PM

Quote:

Originally Posted by dodger21
rm -rf * :winkwink:

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?

mrkris 03-20-2006 02:45 PM

Please tell me you're joking about running that command ...

BoNgHiTtA 03-20-2006 02:46 PM

LOL my god thats hilarious

Evil Doer 03-20-2006 02:47 PM

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?


:error :error :error :error :error :error

Brujah 03-20-2006 02:55 PM

omg i feel sick :(

uno 03-20-2006 02:58 PM

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. :1orglaugh

drjones 03-20-2006 03:07 PM

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.

mrkris 03-20-2006 03:46 PM

Quote:

Originally Posted by uno
Please tell me you're not dumb enough to believe he actually did that. :1orglaugh

In my field you have no idea how many people fall for that heh.

Brad Mitchell 03-20-2006 04:15 PM

You didn't really run that command did you? Nah, couldn't have..

Brad

Why 03-20-2006 05:09 PM

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 :)

High Plains Drifter 03-20-2006 07:55 PM

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.

Brujah 03-20-2006 09:03 PM

thanks, got it tackled and appreciate the tips.


All times are GMT -7. The time now is 02:32 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123