Batch command for ImageMagick to convert all files to a directory and subdirectories on windows

I have thousands of SVG in folder and subfolders. I want to convert them all to jpg or png images.

Can someone help me write a command for ImageMagick (windows) that can find and convert all svg to jpg / png with their original names and store them in the same directories?

Here is an example structure:

C:\SVG\BusinessMan.svg
C:\SVG\Models\Home.svg
C:\SVG\Underlines\underline.svg

And I want this to be after the conversion:

C:\SVG\BusinessMan.svg
C:\SVG\BusinessMan.jpg
C:\SVG\Models\Home.svg
C:\SVG\Models\Home.jpg
C:\SVG\Underlines\underline.svg
C:\SVG\Underlines\underline.jpg
+4
source share
1 answer

Try with a loop FORwith a flag /Rinside the root folder:

FOR /R %a IN (*.svg) DO convert "%~a" "%~dpna.jpg"

.svg , .

, (.bat), %% %:

FOR /R %%a IN (*.svg) DO convert "%%~a" "%%~dpna.jpg"

. Imagemagick

+4

All Articles