1

So, I corrupted a docx file, and everything I tried to repair it failed, and the temporary files were gone. The backup I had was from a few days before I made a massive addition to the file.

I found a way to get just the text by extracting it using 7-Zip, and removing HTML tags online.

I can work with that, but if anyone knows a better way of recovering a corrupt file, then that will be very helpful

https://drive.google.com/open?id=1YUUqHosPzU9fZrB7H9NZf3J76rHDT_UT [archive]

2

Analysis

I took a look at your DOCX file and found that the last save of the file was interrupted, so it's actually missing data. Here are the last ten lines of my attempt to extract the DOCX file (which is, as you've already found, a ZIP file in disguise) with zip -FF Bio\ Exam.docx --out Bio\ Exam.zip:

 copying: customXml/_rels/item1.xml.rels  (174 bytes)
 copying: [Content_Types].xml  (1005 bytes)
 copying: word/media/image184.png  (4149718 bytes)
 copying: word/media/image181.png  (777760 bytes)
 copying: word/media/image179.png  (135904 bytes)
 copying: word/media/image178.png  (331403 bytes)
 copying: word/media/image177.png  (1040822 bytes)
 copying: word/media/image149.png 
        zip warning: no end of stream entry found: word/media/image149.png
        zip warning: rewinding and scanning for later entries

word/media/image149.png is an incomplete file that got truncated by the unexpected end of the DOCX file, and everything after it is lost, including the central directory that would be at the end, shown in purple here:

ZIP-64 Internal Layout

It's not possible to determine what files are missing because the list of the files (central directory) at the end of the ZIP archive was never written.


Recovery

Knowing these facts, your best bet for recovery would be to write the files from the corrupted archive/document into a copy of your outdated backup. Hopefully, this turns into a coherent DOCX file.

To be clear, these are the steps I would try:

  1. Assuming your backup document is called backup.docx, make a copy and name it reconstructed.zip.
  2. Extract all the files you can from the truncated (corrupted) Bio Exam.docx into a temporary folder.
  3. Add all of those extracted files into reconstructed.zip, replacing any existing files.
  4. Rename reconstructed.zip to reconstructed.docx.
  5. Try to open reconstructed.docx to see if the document is usable.
  • Thank you for the in depth help. You have saved me several hours – Noel Jonathan Ellis Mar 12 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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