Changing file extension

I usually change the annoying JPG extension to jpg (I do not like uppercase file names or extensions). For this I use a function I found in shell-fu:

rename_ext() {
   local filename
   for filename in *."$1"; do
     mv "$filename" "${filename%.*}"."$2"

I copied it into my .bashrc file, so that I use it as follows:

$ rename_ext JPG jpg

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*Required Fields