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
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 02-15-2011, 08:28 AM   #1
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,297
anyone wanna lend a hand with this shell script?

basically what it does is takes a directoryof images

kajskj.JPG
evilbunny.gif
anothername.png
funnypic.jpeg

and renames them to 1.JPG, 2.gif 3.png 4.jpeg

what i want to do is make the 1.JPG to 1.jpg and 4.jpeg to 4.jpg

this is what i have so far, it does what i want except for the .JPG and .jpeg part.

Code:
i=1; shopt -s nullglob; for f in *.jpg *.gif *.png *.jpeg *.JPG *.JPEG *.GIF; do mv -- "$f" "$i.${f##*.}"; ((i++)); done
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2011, 09:03 AM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,297
nm figured it out
Code:
    i=1; 
    shopt -s nullglob;
    for f in *.jpg *.gif *.png *.jpeg *.JPG *.JPEG *.GIF; do
        EXT="${f##*.}"
        EXT=${EXT,,}
        EXT=${EXT/jpeg/jpg}
        mv -- "$f" "$i.${EXT}";
        ((i++));
    done
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2011, 10:10 AM   #3
Juicy D. Links
So Fucking Banned
 
Industry Role:
Join Date: Apr 2001
Location: N.Y. -Long Island --
Posts: 122,992
Pussy lips i did it loloolololl

Code:
  i=1; 
    shopt -s nullglob;
    for f in *.jpg *.gif *.png *.jpeg *.JPG *.JPEG *.GIF; do
        EXT="${f##*.}"
        EXT=${EXT,,}
        EXT=${EXT/jpeg/jpg}
        mv -- "$f" "$i.${EXT}";
        ((i++));
    done
Juicy D. Links is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2011, 11:37 AM   #4
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,297
Quote:
Originally Posted by Juicy D. Links View Post
Pussy lips i did it loloolololl

Code:
  i=1; 
    shopt -s nullglob;
    for f in *.jpg *.gif *.png *.jpeg *.JPG *.JPEG *.GIF; do
        EXT="${f##*.}"
        EXT=${EXT,,}
        EXT=${EXT/jpeg/jpg}
        mv -- "$f" "$i.${EXT}";
        ((i++));
    done
could shorten it by doing for f in *.{jpg,jpeg,JPG,JPEG,gif,GIF,png,PNG};
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2011, 12:32 PM   #5
Juicy D. Links
So Fucking Banned
 
Industry Role:
Join Date: Apr 2001
Location: N.Y. -Long Island --
Posts: 122,992
Quote:
Originally Posted by fris View Post
could shorten it by doing for f in *.{jpg,jpeg,JPG,JPEG,gif,GIF,png,PNG};
I concur
Juicy D. Links is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2011, 02:11 PM   #6
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,397
Juicy for pres!
V_RocKs 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



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.