-1

Rename filename.JPG to filename .jpg recursively

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

Danny
  • 521

2 Answers2

2

A little late, but this will work recursively

find . -name '*.JPG' -exec 'sh' '-c' 'mv {} $(sed "s/\.JPG$/\.jpg/" <<< {})' ';'
  • 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 06: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 06:40
  • this worked perfectly....I changed the .JPG to .bmp that solves my issue thanks a ton – Danny Mar 31 '14 at 06:42
0

Sorry I too find it now thanks anyways

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

This will fix my issue

Jenny D
  • 13,172
Danny
  • 521