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