#!/usr/bin/python #change number 6 to desired number of parallel processes #original credit: Kovid Goyal, Calibre author. import os, time, glob, subprocess files = glob.glob('*.epub') workers = [] while files or workers: while len(workers) < 6 and files: f = files[0] files = files[1:] w = subprocess.Popen(['/Applications/calibre.app/Contents/MacOS/ebook-convert', f, os.path.splitext(f)[0]+'.mobi']) workers.append(w) for w in list(workers): if w.poll() is not None: workers.remove(w) time.sleep(0.1)