This script is written in python and hardcoded to check for all ebooks in your working directory and convert them to a mobi format.
You specify the source type, for example if you run python3 convert_ebook2.py pdf
it will look at all pdfs in the working dir and convert them to mobi, if a mobi version of that file doesnt exist.
Script could be easily modified to take a variable for output file type.
This requires the Calibre libraries, and was written to be used on Linux.