'Remove string from all filenames in Linux folder

I have folder with 1000 JPG files like this:

17.png.jpg
341.png.jpg
882.png.jpg
997.png.jpg
1023.png.jpg

I need to rename all the list so the number will stay and remove just the ".png" Result expected:

17.jpg
341.jpg
882.jpg
997.jpg
1023.jpg

What is the linux/mac command I should run?



Solution 1:[1]

If you have bash available, you can type

for i in *.png.jpg
do 
    mv "$i" "${i%.png.jpg}.jpg"
done

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mathieu