Create Ebook (epub) From Text File

This is how I make ebooks (*.epub) from plain txt files.

I wanted to read a rather lengthy text with my smartphone - but the orignal source sucked and had no mobile version of the text. So I thought why not create an ebook which is perfect to read on a smartphone.

Here is how I did it (on Windows):

If there is more than one text file, a batch would be great. The following batch will make an epub file from every txt file in that directory:

cd c:\users\johndoe\desktop\epub-cr
for /f %%a in ('dir /b *.txt') do "C:\Program Files (x86)\Calibre2\ebook-convert.exe" %%a %%~na.epub

What it does:

  • cd into the directory which holds all the txt files
  • iterate in a loop over every txt file (dir /b *.txt), store the filename in the variable %a
  • execute Calibre's convert program with the source (e.g. xyz.txt)
  • strip the file extension from %a (%%~na) and add .epub as the new extension
  • if the txt file was named xyz.txt a coresponding xyz.epub will be created

Now you can open the epub files with your favorite ebook reader and start reading with comfort :-)

stuff/create_ebook_from_text-file.txt · Last modified: 2015-10 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready