How to convert jpg files to png files using linux command? + Difficulty = Subfolders

I want to convert several jpg files to png files. As far as I know, this command can be used

mogrify -format png *.* 

I have one problem, I have many subfolders. Say a is my main folder, and b, c and d are subfolders. Images are in subfolders.

How to convert all images without having to open each folder manually?

-> I would like to write a command that works when I'm in folder a , but works for all files in subfolders.

+7
linux folder png jpeg mogrify
source share
1 answer

Assuming you are in a folder, the following might be done for you:

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

You can use the find command to get all jpg files in all subfolders and pass the command as an argument to search

+12
source share

All Articles