Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've had success unzipping and examining the interior of a .docx file, but I can't seem to get the re-zipping to work properly. I've tried no compression (command line: zip -0r ...), the archive utility, and a 7zip plugin but none of that works. All of the .docx files I create won't open in the original programs, even when I don't change a single file. Any tips?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

It is important that the files that make up the docx are not within another folder, i.e. [Content_Types].xml must be in the root of the resulting zipped file. A similar question has been asked on StackOverflow.

When you open (or extract to the current directory) the zip file, you should have something similar to the following:


If you have those files within another directory inside the zip or docx file, it won't work. Note that I don't get the customXml folder on an empty Word document, but the report I originally tested with did have it. You may have some more (or less) directories.

The command to rezip these, issued from the "current directory", is:

zip -r preso.pptx *
share|improve this answer
Thanks. I think the other key was to only edit things with the Terminal. Even after adding -x .DS_Store, it would still not work unless I didn't use the Finder to navigate, ever. So I just used textmate and all's well. –  acsmith Apr 13 '12 at 4:41
I'm not sure, not having a Mac to test on, but a problem may be caused by Mac and its apps defaulting to the CR newline marker and Word expecting a CR+LF, even though the XML specifications say to treat them all the same way. I can't say whether Word follows that specification properly or not. There could also be some unexpected encoding changes, or even a hidden file created, once again I can't say anything for sure. It seems you have found a workaround anyway. –  Bob Apr 13 '12 at 4:48
Yeah, I think it was the Finder. I can even open the xml files in textmate or whatever, edit, save, and as long as I do all the zipping/viewing/unzipping in the terminal it's fine. Seems to work now -- the root file thing was the problem. Thanks. –  acsmith Apr 20 '12 at 4:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.