Find and rename all pictures with incorrect file extension
问题 I'm looking for a way to automate renaming all images with a wrong filename extension. So far I at least found out how to get the list of all these files: find /media/folder/ -name *.jpg -exec file {} \; | grep 'PNG\|GIF' > foobar.txt find /media/folder/ -name *.png -exec file {} \; | grep 'JPEG\|GIF' >> foobar.txt find /media/folder/ -name *.gif -exec file {} \; | grep 'JPEG\|PNG' >> foobar.txt However, I would also like to automate the renaming. I tried things like find /media/folder/ -name