Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Rename filename.JPG to filename .jpg recursively

I want all the files with .JPG extension to be changed as .jpg

share|improve this question

marked as duplicate by jasonwryan, slm, Bernhard, Hauke Laging, Flup Mar 31 '14 at 8:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

A little late, but this will work recursively

find . -name '*.JPG' -exec 'sh' '-c' 'mv {} $(sed "s/\.JPG$/\.jpg/" <<< {})' ';'
share|improve this answer
I need to change the .bmp to .jpg how can I do that...I get this error in ur script sh: Syntax error: redirection unexpected – Danny Mar 31 '14 at 6:32
@Danny It is working for me, on both bash and zsh. What are you using? Judging by the error, try: find . -name '*.JPG' -exec 'sh' '-c' 'mv {} $(echo {} | sed "s/\.JPG$/\.jpg/")' ';'. For the .bmp to .jpg, is it just the extension or do you want to convert the file? – PlasmaPower Mar 31 '14 at 6:40
this worked perfectly....I changed the .JPG to .bmp that solves my issue thanks a ton – Danny Mar 31 '14 at 6:42
up vote 0 down vote accepted

Sorry I too find it now thanks anyways

rename 's/\.([^.]*$)/.\L$1/' *.JPG

This will fix my issue

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.