0
I have folders with photos in each in tiff format.
What i am looking to do is merge the images in each folder and name the output with the folder name it resides in.
I have folders with images loaded in each:
( photo1.tiff, photo2.tiff, photo3.tiff, photo4.tiff)
(photoa.tiff, photob.tiff,)
I've tried to merge all the tiffs in the individual folders using the script below.
#!/bin/bash dirs=$(find . -type f -name "*.tiff" | xargs dirname |sort -u) r d in $dirs; do #ls $d/*.tiff # just debug info, should list all desired tiffs #echo $(cut -d/ -f3 <<<$d) # debug info, should be desired output file name convert $d/*.tiff $(cut -d/ -f3 <<<$d).tiff done
When i run the script i get a single tiff which combines all photos from all folders. How can I batch convert subfolders that contain multiple images (TIFFs) and make a single tiff in each folder and give the image the name of its folder? Any suggestions greatly welcomed.
Please note that https://superuser.com is not a free script/code writing service. If you tell us what you have tried so far (include the scripts/code you are already using) and where you are stuck then we can try to help with specific problems. You should also read How do I ask a good question?.
– DavidPostill – 2018-05-08T20:30:34.630Hi David, I've tried to narrow it down and make it a bit more friendly. Thanks to music also who helped in edit it a bit more friendlier than even i've written. Hopefully I've made the changes to suit. Many thanks. J – Jamjam – 2018-05-09T07:04:30.493
Much better. I've also added [tag:bash] and reopened. – DavidPostill – 2018-05-09T08:34:21.237