The files and directory structure of the EPUB files is specified in the OCF (OpenContainerFormat). There are two versions are most interesting: 2.0.1 and 3.0.1. Both specify only one required file in a specific subdirectory, and that is:
META-INF/container.xml
There are some optional files that can go in that directory as well (signatures.xml
, encrytpion.xml
, metadata.xml
, rights.xml
) and a file named manifest.xml
is allowed there as well.
The container.xml
refers to the full path of one or more files, which names are essentially free and the directory structure as well.
Of course some programs generate EPUB files always with the same structure. That is why it might seem that you need a content.opf
in the root of the EPUB (zip) file structure, but that is only a valid name in any particular EPUB if and only if it is named in a <rootfile>
element in the container.xml
.
The contents file (with references to the individual) HTML files which together form the e-book could be:
TOC/TableOfContents.opf
and the HTML files could be
LOTR/The_Fellowship_of_the_Ring.htm
LOTR/The_Two_Towers.htm
LOTR/The_Return_of_the_King.htm
as long as the paths of files, specified internally starting from container.xml
are correct.
As Mark pointed out a mimetype
file needs to be present. Actually according to the 2.0.1 spec (page 7, bottom) that file has to be the first file in the EPUB file's ZIP structure.
The only names in the root directory reserved by the 2.0.1 are mimetype
and META-INF
. The use of a specific folder (LOTR
in the example) is recommended (to prevent collisions when there are multiple renditions), but not required.