Reputation: 73
I need to write a .bat file that will recurse through a directory structure and convert all epubs to mobis on the command line. I have Calibre installed, and the basic command-line for this is
ebook-convert MyFile.epub MyFile.mobi.
I'm sure this is a synch for someone out there, but I have been trying to do it half the morning without success.
Any help very much appreciated.
Upvotes: 0
Views: 436
Reputation: 11
Try:
for /r %I in (*.epub) do "ebook-convert.exe" "%I" "%~nI.mobi"
Good luck!
Upvotes: 1
Reputation: 73
OK, eventually got it to work:
FOR /r "THE_FOLDER I AM RECURSING TO/" %%f IN (*.epub) do (
SET FILE= %%f
SET TITLE=!FILE:~1,-5!
ebook-convert %%f "!TITLE!.mobi"
)
Upvotes: 1