View Single Post
Old 02-15-2011, 08:28 AM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,304
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