An ePub Tutorial‎ > ‎

Creating the Epub File

Epub is, in essence, nothing more than a ZIP archive of files. (Mobipocket is actually the same way, except that it uses a Palm-specific format.) You can create it with zip, but as mentioned somewhere before, you need to exclude extra file attributes. Epub depends on the mimetype file to be of the correct byte length—and also for this reason, the mimetype file must come before all the other ones.

If you have Info zip, on the command line run:

zip -Xr9D The_Velveteen_Rabbit.epub mimetype * -x .DS_Store


-X: Exclude extra file attributes (permissions, ownership, anything that adds extra bytes)

-r: Recurse into directories

-9: Better compression

-D: Don’t list directories as separate entries in the zip file

-x .DS_Store: Don’t include Mac OS X’s little hidden file of snapshots etc.