I would like to do something like
find ./ -type f | parallel --gnu convert "{}" "$(basename "{}" pdf)jpg"
But it does not work (the files are renamed to filename.pdfjpg
). I think the problem is that the subprocess is executed right away (even before calling parallel
). I would like the subprocess to be executed for each file.
Thanks to find -exec with multiple commands I can do:
find *.pdf -exec sh -c 'convert "$1" "$(basename "$1" pdf)png"' _ {} \;
but I would like to use GNU parallel
. The following does not work:
find ./ -type f | parallel --gnu sh -c 'convert "$1" "$(basename "$1" pdf)jpg"' _ {}
Of course, I can do this with two commands (e.g. using rename
) but I would like to learn how to do it with one and with GNU parallel
.