ncsuapex
02-23-2006, 02:34 PM
I have a script that changes all file extensions from .jpg to .JPG. I have written the script to go from .JPG to .jpg as well. What I need help with is. How would I edit the script to do either convert them from .jpg to .JPG or .JPG to .jpg
My current script is:
#!/bin/bash
# I just run the script and make sure I put a # at the start of the line I don't # need.
for i in *.jpg; do j=`basename "$i" .jpg`; mv -v "$i" "$j.JPG"; done
for i in *.JPG; do j=`basename "$i" .JPG`; mv -v "$i" "$j.jpg"; done
How would I make it check for jpg and change it to JPG, if there are no jpg, then it needs to check for JPG and then convert them to jpg.
Thanks
My current script is:
#!/bin/bash
# I just run the script and make sure I put a # at the start of the line I don't # need.
for i in *.jpg; do j=`basename "$i" .jpg`; mv -v "$i" "$j.JPG"; done
for i in *.JPG; do j=`basename "$i" .JPG`; mv -v "$i" "$j.jpg"; done
How would I make it check for jpg and change it to JPG, if there are no jpg, then it needs to check for JPG and then convert them to jpg.
Thanks