0

I am looking for a way of automating a manual conversion of directories containing images (jpgs & pngs) into PDF's. For example ..

I currently use the following command to achieve what I want but I have to do this manually for each directory so it can become a little time consuming, etc

convert DIRECTORY1/*jpg DIRECTORY1.pdf
convert DIRECTORY2/*jpg DIRECTORY2.pdf
convert DIRECTORY3/*png DIRECTORY3.pdf

I would like a way of converting all the directories in the current location to individual pdf files at once.

Any help would be appreciated.

derHugo
  • 3,376
  • 5
  • 34
  • 52

1 Answers1

0

Something like will walk in the tree, extract directories and do the conversion. Be aware this can have problems with directory names which contain space or special symbols:

for i in `find . -type d`
do
convert "${i}/*jpg" "${i}/*png" ${i}.pdf
done
Romeo Ninov
  • 709
  • 7
  • 13