epub folder zip -- one file must not be compressed

At http://idpf.org/epub/30/spec/epub30-ocf.html under “3.3 OCF ZIP Container Media Type Identification” it says that the “mimetype file additionally must be neither compressed nor encrypted, and there must not be an extra field in its ZIP header.”

  1. Is there a way to zip a folder but specify that this one file not be compressed? Or 2) Is there a way to zip a folder without compressing anything, but still have it be a valid zip (epub) file? Or 3) Could I zip the folder normally and then replace the compressed mimetype file with an uncompressed version? And 4) WTF? Why would they require a non-compressed file in a compressed folder? That seems strange to me, as I’ve never run into such a requirement before.

Thanks for any help or insight on this. My goal is to easily zip a folder and change its extension from “.zip” to “.epub” via Applescript to get a valid epub file.


Please see man zip

From the man page:

Added the -Z option to the quote.

Thanks. The mimetype file has no extension to filter by, so I tried:

set fn to “HTML5_CSS3_Book.zip”
set dn to “HTML5_CSS3_Book”
do shell script “zip -r -0 ~/Desktop/” & fn & " " & “~/Desktop/” & dn

This zipped the folder and the result said 0% compression on all files, but the byte count shown in the Finder Info Window differed for the folder and the zip that I made. But it seems like this would probably work.

I hope it does!

The difference may be that the zip program counts 1k as 1024 while the Finder counts 1k as 1000.

I would test it carefully anyhow if I were you. :expressionless: