Convert a lot of files in subdirectories automatically

Hi,

I have a huge structure of directories and subdirectories contsining some data. The lowest folders contain a file "image.png" which need to be converted to "folder.jpg". But how can I do that for all these files automatically? That's what I alredy have

find /path -type f -name "image.png" -exec convert "{}" "???" \;

My question is the "???" part - what do I have to write there to not to get the path to the "image.png" but the path to the new "folder.jpg", means how can I change the file name part in this command?

Thanks!

Please, change the echo for a mv -v if you like the output.

find /path -type f -name "image.png" | while IFS= read f; do echo "$f" "${f%/*}/folder.png"; done
1 Like