Question

I want to convert several jpg files into png files. As far as I know, one can use this command

mogrify -format png *.*

I have one problem, I have a lot of subfolders. Let's say a is my main folder and b,c and d are subfolders. The images are in the subfolders.

How can I convert all images without having to open every folder manually?

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

Was it helpful?

Solution

Assuming you're in folder a the following might work for you

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top