[英]How to convert jpg files into png files with linux command? + Difficulty = Subfolders
I want to convert several jpg files into png files.我想将几个 jpg 文件转换为 png 文件。 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.假设a是我的主文件夹,而b、c和d是子文件夹。 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. -> 当我在文件夹a中时,我想编写一个有效的命令,但适用于子文件夹中的所有文件。
Assuming you're in folder a the following might work for you假设您在文件夹 a中,以下可能对您有用
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您可以使用 find 命令获取所有子文件夹中的所有 jpg 文件,并将您的命令作为参数传递给 find
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.