Recursive converting multiple files from PNG to JPG

Quick tip on how to convert recursively multiply PNG files to JPG format. What do we need:

  • Linux
  • Bash
  • RMagick
  • Recursively stored PNG files
  • A bit of patience ;)

First lets convert all the PNG files:

 find ./ -name "*.png" -exec mogrify -format jpg {} \;

And after this, if everything went fine, we can remove all PNG "leftovers":

find ./ -name "*.png" -exec rm {} \;

Of course remember to change the ./ directory into your PNG files directory.

Categories: Hosting, Linux, Software

1 Comment

  1. Works beautifully on MacOS as well, but your example contains “echo” which should be removed if you want it to convert anything :)

Leave a Reply

Your email address will not be published. Required fields are marked *


Copyright © 2024 Closer to Code

Theme by Anders NorenUp ↑