Batch command for ImageMagick to convert all files in a directory and sub-directories on windows

前端 未结 3 740
时光说笑
时光说笑 2021-02-07 20:56

I have thousands of SVG\'s in a folder and sub-folders. What I want is to batch convert all of them to jpg or png images.

Can someone

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 21:25

    Try with a FOR loop with /R flag from inside your root folder:

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

    this command will convert all the .svg files in your sub-directories under the root folder you launched your command from.

    Above command works for command line, if you plan to use the command inside a batch file (.bat) remember to use %% instead of %:

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

    See this page of Imagemagick documentation for more info

提交回复
热议问题