is now part of CreativePro.com!

*** From the Archives ***

This article is from December 2, 2010, and is no longer current.

Unzip and Zip EPUB files safely with these AppleScripts

29

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. EDIT Feb 15, 2016: Go to the first post in this forum thread and download the latest version of the Zip/Unzip Applescript (one script that does both) that author Paul Durrant has posted: https://www.mobileread.com/forums/showthread.php?t=55681 … OR, Mac/Windows users should download the free utility, eCanCrusher, by Rorohiko here: https://www.docdataflow.com/ecancrusher/ 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.

Anne-Marie “Her Geekness” Concepción is the co-founder (with David Blatner) and CEO of Creative Publishing Network, which produces InDesignSecrets, InDesign Magazine, and other resources for creative professionals. Through her cross-media design studio, Seneca Design & Training, Anne-Marie develops ebooks and trains and consults with companies who want to master the tools and workflows of digital publishing. She has authored over 20 courses on lynda.com on these topics and others. Keep up with Anne-Marie by subscribing to her ezine, HerGeekness Gazette, and contact her by email at [email protected] or on Twitter @amarie
  • Gusgsm says:

    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.

  • Dan Rodney says:

    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.

  • Sarah says:

    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!

  • 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.

  • Adam can you share those at all? Or a little more detail on how you made them (so you can include Terminal commands in an Automator action?)

  • Colleen Cunningham says:

    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

  • Tim says:

    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.

  • Dan Rodney says:

    Yes, you can actually drag a bunch of files on to bulk zip or unzip them all at once!

  • Cari Jansen says:

    PDFXMLInspector (available from Adobe Labs) https://labs.adobe.com/technologies/mars/ (see bottom of page – step 7.)

    Works really well too.

  • Johan van Ooijen says:

    Hi,

    I use Oxygen to edit the epubs. Really great and works every time.

  • K says:

    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.

  • 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.

  • Mike Kukavica says:

    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?

  • What file format are the images you’re trying to open?

  • Mike Kukavica says:

    They are all .jpeg files. For example, here’s the file name of one:

    f0016-03.jpg

  • Well, that’s weird. Probably got corrupted somewhere along the line. Might try Photoshop. If that doesn’t work, then try unzipping again. It’s a mystery!

  • G. Raja says:

    Hi All,

    Can anyone confirm on having unzip and zip scripts to work in Windows?

  • G. Raja says:

    I’m using InDesign CS6.

  • G. Raja, you don’t need those scripts to work in Windows. Just rename the .epub extension to .zip and then Unzip the file using the built-in Windows utility or a free 3rd party product like 7-zip.

    Or there’s a script that will convert a folder of files into an EPUB, like if you’re starting from scratch: https://sourceforge.net/projects/epubpack/

    • 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:

      https://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?

  • Dear Anne marie,
    Doing your excellent course on EPub Fundamentals, you instruct to use Unzip to change the CSS in ePubs. However, the downloaded link for this app downloads a “This file is damaged and cannot be used”. Tried several times. Does Dan have a version for Yosemite or InDesign CC? What is the problem?

  • I just updated this very old post with new links. Dan Rodney’s scripts aren’t needed anymore.

    Here’s what I added:
    EDIT Feb 15, 2016: Go to the first post in this forum thread and download the latest version of the Zip/Unzip Applescript (one script that does both) that author Paul Durrant has posted: https://www.mobileread.com/forums/showthread.php?t=55681 … OR, Mac/Windows users should download the free utility, eCanCrusher, by Rorohiko here: https://www.docdataflow.com/ecancrusher/

  • Kirsten Bach Larsen says:

    I have been using the the old (just found out) versions the Zip and Unzip scripts several times. I have Unzipped and Zipped a xhtml file (originally an indd file) back and forth I don’t know how many times and every thing worked perfectly – BUT …

    I then wanted to make an epub of more than one file by using Book in Indesign. It worked nicely – all the files were in OEBPS folder. I opened the epub file and it didn’t look quite as I wanted. Fine I know how to correct this. I then UnZipped one of the files in the OEBPS folder. It opens nicely in Dreamweaver. I can make all my corrections. Save the xhtml and finally Zip every thing back to a new epub.

    Testing the new epub file in IBooks and there you go it will not open – The book has been ruined (Message from IBooks).

    Why can’t I use Unzip/Zip when using Indesigns Book Panel to create the epub? What is the difference to working with just one file?

    I did create a nav toc and added it to the first file in the Book panel. I used the same css file as to all the ‘single’ files I created.

    What am I doing wrong?

  • Bonjour, merci pour ce jeu, voici mes réponses :bébé CharlotteGregor le fortTugdual le boudeurAziliz la féele chevalier ThibaultFleur la mamanVoici mes lots préférés: dans l’ordre 3,1,2.

  • YEah…I have the sunglasses thing down – I do wear them inside and at night…my excuse they are a headband – plus my invisibility cloak. Anytime I see someone approaching who I want to avoid on goes the invisibility cloak :)

  • >