How do I re-zip/compress an expanded IDML file

Home Forums General InDesign Topics How do I re-zip/compress an expanded IDML file

Tagged: ,

This topic contains 5 replies, has 3 voices, and was last updated by  Eli Adadevoh 3 years, 6 months ago.

  • Author
  • #74851

    Eli Adadevoh

    I have an IDML file that I unzipped. I now want to compress the expanded folder back into an IDML file. I have access to a Mac or Linux machine.

    What are the ways I can do this?

    NB: Zipping the file using zip (command line) or with Keka, BetterZip or Archive Utility don’t work. Here’s the message I get.

    Cannot open the file. Adobe InDesign may not support the file format, a plug-in that supports the file format may be missing, or the file may be open in another application.

  • #74853

    David Blatner

    This is an interesting problem! I wonder if something changed so that it no longer works the way it used to?
    I just discovered that the EPUB zip/unzip applescripts do work. You just need to change the “.idml” extension to “.epub” — or, after turning a folder into an epub, change the file extension from .epub to .idml.
    We discussed those applescripts here:
    but it looks like the newest version of the applescripts are here:

  • #74864

    Chuck Weger

    The problem with regular zip is that the zip archive contains a “mimetype” file that shouldn’t be compressed if you want InDesign to identify the newly-created IDML. So the way you have to re-zip the file (and the way the ePub scripts work) is like this:

    1. They first create a zip archive which contains only the mimetype file, uncompressed.
    2. Then they add the rest of the files/folders into the zip archive, this time with full compression.

    In shell script terms, the ePub scripts do this (assuming the current directory is the one containing all the IDML contents):

    zip -X0 ‘myfile.idml’ mimetype # create the zip archive ‘myfile.idml’, containing only the ‘mimetype’ file with no compression

    zip -rDX9 “myfile.idml” * -x “*.DS_Store” -x mimetype # add everything else to the ‘myfile.idml’ archive, EXCEPT .DS_Store files and the ‘mimetype’ file (which is already there from the previous step)

    To save you time reading the zip man page, here’s what all these options mean:

    -X = “no extra” — do not save extra file attributes like user/group ID for each file
    -0 = “compression level zero” — no compression
    -r = “recurse paths” — go through everything in the directory, including nested subfolders
    -D = “no directory entries” — don’t put special stuff in the zip archive for directories
    -9 = “compression level 9 (optimal)”
    -x = “exclude these files”

    Follow this voodoo, and you should be able to create legal IDML files.

    • #74885

      Eli Adadevoh

      Thanks Chuck, such a detailed post. I now completely understand exactly what’s going on. Thanks again.

  • #74880

    David Blatner

    Wow, thanks for the great explanation Chuck!

    Mike Rankin just pointed me to this variation on the epub scripts mentioned above:

    It creates a drag and drop applet. The first time you run it you may need to double-click it, or right-click and choose Open from the context menu (Just to tell the Mac that it’s okay to run this new app.) But after that, you can just drag an IDML file on it to turn it to a folder. Then drag the folder back on it and it converts to an IDML file (with a + symbol to indicate it’s been changed).

You must be logged in to reply to this topic.