Unzip and Zip EPUB files safely with these AppleScripts

During Liz Castro’s recent InDesign to EPUB webinars (Part 1 and Part 2) for InDesignSecrets, some of the attendees wondered why she used Terminal (OS X’s command line interface utility program) to do simple things like zip and unzip the EPUB files in order to edit its component CSS and XHTML files.¬† On Windows, you don’t need to use a Terminal-like program. You can extract and re-archive the component files of an EPUB just like any .zip file. Not so on a Mac.

I wondered why Liz used Terminal too, to be honest. Nothing against UNIX, but why not just use an OS X shareware utility like Springy or BetterZip … two programs that let you edit the contents of zipped files without needing to unzip them first? Liz told us that she’s simply “never had any luck” with those programs; the EPUB files she ends up with won’t validate or won’t even open sometimes. Since Terminal is free, and she just needed to do a couple simple things with it, and most importantly, it worked … why not just use Terminal? Makes sense.

I’ve just learned of a couple free AppleScripts for extracting and rearchiving EPUBs on a Mac that should make Terminal-phobes happy.

I don’t want to link to the scripts directly here, since they’re hosted on another site: the MobileRead Forum, a must-follow community forum for anyone creating eBooks. Just go to the EPUB Zip for Mac OS X thread there, and about five messages down you’ll see Dan Rodney’s post that includes a download link for the latest version of the two scripts: ePubUnZip1.0 and ePubZip1.0.3.

In his post, Dan says that these are his updates to the original ePub Zip script that another user, “pdurrant,” created. (Mr./Ms. Durrant runs a publishing company in the U.K. and is a prolific poster to the MobileRead forum.)

If Dan Rodney’s name sounds familiar, that’s because he’s the wonderful guy who gave us the Proper Fractions script for InDesign (now in ver 2.0, I see, and still available as both a free and a paid app). If you’re a Mac user, or an iPod or iPad user, you should check out Dan’s web site. He has a ton of great tips couched in one of the most simple and elegant web site designs I’ve ever seen this side of Cupertino.

But I digress. Mac users, after you unzip the ePubUnZip and ePubZip Applescripts, you can just double-click them in the Finder as needed. You’ll get an Open/Save dialog box asking you where the EPUB is that it should unzip (it extracts it all to a folder of the same name at the same level); or if you double-clicked the ePubZip script, you’ll be prompted to select a folder that contains your EPUB component files.

Related Articles
Comments

21 Comments on “Unzip and Zip EPUB files safely with these AppleScripts

  1. Interesting but I think that, once you’ve got an e-book, if you need to touch it up, it’s now easier to do that with Calibre, that (since version 7.2x, I believe) allows you to deploy and rebuild its content on the fly and to see as well the changes you have done.

  2. I like using Dreamweaver to edit HTML and CSS, so that’s why I like using these scripts. Sigil, etc. are nice for small touch ups to code, but for bigger changes I prefer Dreamweaver.

    My first experience with Springy was that is crashed and corrupted my ePub file. Maybe this is not typical, but it scared me away. Plus it expands just the file you are editing, so pictures in the XHTML file may not be visible in Dreamweaver’s Design view. It just seemed a bit weird to me. I like the idea or it better than the app.

    These scripts are quick & easy to use and free… so enjoy! And many thanks to pdurrant. He did most of the hard work and I took it the last step.

  3. I’ve been using this ePubZip app for quite a few months and LOVE it. Super easy and never had a problem with epub validating. Thanks Dan and pdurrant!

  4. I built something like these as Automator workflows (Control-click an EPUB and choose the workflow to expand the file to a work folder on the desktop, and then Control-click the work folder and choose the other workflow to build the new EPUB), and we included epubcheck in the zipping workflow. A little crude, but effective and much faster than mucking about with the command line.

  5. Wow, how timely with my Tweet today about my zipping/unzipping issues! Thanks for the info. BTW, Terminal isn’t as scary as I thought. But it’s not the fastest way for sure. It’s always fascinating to me to hear about all the different workflows we all have when we’re working on ePubs.

    @BookDesignGirl

  6. Worth noting that these are AppleScript “droplets” (denoted by the arrow on the icon) which means they’re designed to allow you to drag items onto them.

  7. Ah. So here are some suggestions as to how to get around my problem. But I still don’t understand why, when I watch your ecourse, Wrangler and Springy work together, but for me, the two seem to corrupt the epub file so it won’t open.

  8. I’ve been using these scripts for a while now and they’ve been really helpful. I’ve also gotten a lot of use out of the ePubCheck drag-and-drop script. So far it’s been updated for 3.0b4. Works like a charm. It’s also on the Mobile Read Forums.

  9. Just today, I tried to unzip an ePub book from iTunes, and none of the images will open; I get the message that the image is in a file format that isn’t recognized, It may be damaged or use a file format that Preview doesn?t recognize.

    Has anyone else had this experience?

    • I am adding to an old thread, I know. Just to point out another free option, which works on Mac and Windows, and offers drag/drop zip/unzip for EPUB.

      You can download eCanCrusher from the ePubCrawler page:

      http://www.rorohiko.com/epubcrawler

      It also allows you to customize the ‘overwrite’ behavior: i.e. tell it what to do when ‘flip/flopping’ an EPUB, and the ‘old’ file or folder is still ‘in the way’: silently overwrite, overwrite with dialog, rename?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>