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?
Zipping the file using zip (command line) or with Keka, BetterZip or Archive Utility don't work. InDesign issues the error:
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.
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:
They first create a zip archive which contains only the mimetype file, uncompressed.
zip -X0 'myfile.idml' mimetypeThen they add the rest of the files/folders into the zip archive, this time with full compression.
zip -rDX9 "myfile.idml" * -x "*.DS_Store" -x mimetypeIn 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 compressionzip -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.
Source: http://indesignsecrets.com/topic/how-do-i-re-zipcompress-an-expanded-idml-file
A big thanks to Chuck Weger and David Blatner at http://indesignsecrets.com