转换为另一个文件夹

问题描述 投票:0回答:1

这个命令对我有用:

To run from cmd.exe:
convert *.jpg -set filename:f "%t.%e" "%[filename:f].png"

The same, to run from bat-file (double % instead of single):
convert *.jpg -set filename:f "%%t.%%e" "%%[filename:f].png"

现在,让我们假设我有这个文件层次结构:

test\
 |-- small\               <-- this is an empty folder
 |-- image1.jpg
 |-- image2.jpg

我应该如何修改现有脚本以输出小文件夹中的文件,如下所示?

Current behaviour:
test\
 |-- small\
 |-- image1.jpg
 |-- image2.jpg
 |-- image1.jpg.png
 |-- image2.jpg.png

Desired behaviour:
test\
 |-- small\
      |-- image1.jpg.png
      |-- image2.jpg.png
 |-- image1.jpg
 |-- image2.jpg

我试图使用%~dp0,但目前没有运气。

batch-file cmd imagemagick image-manipulation imagemagick-convert
1个回答
1
投票

我想我明白了,但在尝试之前做一个备份:

mogrify -path small -format png *.jpg

我没有随时可以测试的Windows,但根据您的评论尝试:

convert *.jpg -set filename:f "%%t.%%e" "small/%%[filename:f].png"
© www.soinside.com 2019 - 2024. All rights reserved.