Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 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.

2 Answers 2

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 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 at 6:40
    
this worked perfectly....I changed the .JPG to .bmp that solves my issue thanks a ton –  Danny Mar 31 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.