The syntax for the command convert
in ImageMagick is
convert source_filename.ext1 destination_filename.ext2
I would like to use zsh to feed it with files in a folder path_to_source
and output the result (files with same name, but with a different extension) under the folder path_to_destination
.
I believe I can use find
and xargs
for this, but I didn't come up with anything that worked. Also I presume that ZSH may have some builtins that are useful for this. Any pointers would be greatly appreciated.
NOTE: As far as I know, convert
does not have a native way of handling a batch of files, so I need to feed the files one by one. In either case, I'm interested in solving the problem of feeding a command file by file with these arguments.
Best Answer
The
r
in${x:r}
is a history modifier. There's a short form offor
that saves a few characters.