Reputation: 176
find /home/folder1/folder2/folder3/my\ Raw\ Data/"$1"/"$2"/"$3"/"$4" -type f -name "*.tif" -exec bash -c 'tiff2pdf "$1" -o "${1%.tif}".pdf' - '{}' \;
This is my bash script to convert tif files in /home/folder1/folder2/folder3/my\ Raw\ Data/"$1"/"$2"/"$3"/"$4"
to pdf .The output pdf will also get saved in same location, But
I want the output pdf in /home/folder1/folder2/folder3/my\ Raw\ Data/"$1"/"$2"/"$3"/backup
.
How is it possible without using a loop? Is there any solution for this ?
Upvotes: 2
Views: 1152
Reputation: 207465
Here's a way to get them all done in parallel, without any loops, using GNU Parallel:
cd /path/to/tiffs && parallel tiff2pdf {} -o ../backup/{.}.pdf ::: *tif
Try like this first to see what it would do, without doing anything:
cd /path/to/tiffs && parallel --dry-run tiff2pdf {} -o ../backup/{.}.pdf ::: *tif
Here's another way with ImageMagick:
cd /path/to/tiffs && magick mogrify -path ../backup -format PDF *tif
Upvotes: 2