I used the following command to convert and merge all the jpg files in a directory to a single pdf file.
jpg
convert *.jpg file.pdf
Th
Or just read the ls manual and see :
ls
-v natural sort of (version) numbers within text
So, doing what we need in single command.
convert `ls -v *.jpg` foobar.pdf
Have fun ;) F.