Sample Header Ad - 728x90

img2pdf batch script

0 votes
2 answers
1914 views
I currently have over 10K folders. Each folder has .png and .jpg images that need to be turned into .pdf files. Files are numerically in order already. I am looking for speed. I can currently cd into each folder and run img2pdf * -o out.pdf And I get a perfectly created out.pdf in less than a second, even with several hundred images. My end goal is to automate this in a shell script that can be invoked, so each folder is basically turned into a .pdf file with the filename the same as the old directory like so Directory001/img001.jpg img002.jpg img003.jpg OtherDirectory/img1.png img2.png img3.png becomes Directory001.pdf OtherDirectory.pdf while only use img2pdf to do this, as it is by far the fastest way create the pdfs. I have some simple bash experience, but only with simple one liners (like turning all directories to zips). I know this can be done, but have no idea where to begin.
Asked by lolimans (1 rep)
Feb 17, 2019, 03:00 PM
Last activity: May 22, 2025, 11:07 AM