Message Boards Message Boards

5 Replies
4 Total Likes
View groups...
Share this post:

File corrupted

Posted 11 years ago
 I had a very important file corrupted. Please can someone help me. I'm Mathematica User many years and never had this problem. And now happened to a very important file. I am sending the attached file, you guys can fix it?
POSTED BY: Cleuzir da Luz
5 Replies

I might be a little late, but I decided to take a look at the file.

All Mathematica notebooks are actually stored in a (semi) human-readable symbolic form, represented by a nested set of Cell[] objects. When one knows where the error is, one can manually repair a corrupted notebook.

Mathematica reported the error as being in the last cell group. I wasn't able to find its exact origin, so I had to delete the group. Then an error was reported in some form of cache information at the bottom of the file, stored in comments. My guess is that it has something to do with undo history or clipboard storage. I deleted that as well, as it shouldn't be essential to the operation of the notebook.

That was enough to get the notebook open, but at the bottom of your content there was an oddly large large string of text starting with a U, probably a remnant of the corruption.

Large remnant.

Below that there was a set of text cells containing the actual raw contents of the file. I have absolutely no idea why Mathematica loaded the file in this way, but I deleted them.

Finally, the file was rid of corruption. Hopefully it's still useful!

POSTED BY: Jesse Friedman

Slightly relates as it has to do with keeping backups of your work, and there have been several discussion recently about corruption and backups, take a look at this tool that I recently posted on:

POSTED BY: David Reiss
Tech Support recommends making a copy of the damaged file and working with the copy.

The second method Sean shows is the newer and usually (but not always) better code for this.
POSTED BY: Bruce Miller
Please see this article on repairing corrupted notebooks.

If this doesn't work try to evaluate the following code:
 Quiet[cell=Check[Read[strm,Expression],tmpChar=" ";endPos=StreamPosition;
 tmpChar=Read[strm,Character]]; If[endPos>beginPos,SetStreamPosition[strm,beginPos];

Then run the function RecreateNotebook on the file path to the corrupted file. 
You can use Insert > FilePath... to insert the file path into the notebook. 

If you still see any issues, contact Wolfram Technical Support at with your name and license number or activation key. 
POSTED BY: Sean Clarke

The link: appears to be out of date as there is no *RestoreNotebookAT[]function in AuthorTools in Mathematica 10. There is a RestoreNotebook[] function.

It appears my notebook and backup of my notebook on a separate drive are too far gone to benefit from the code for RecreateNotebook above.

POSTED BY: Doug Kimzey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract