Recovering a corrupted .txt file

30,542

Solution 1

This answer is for posterity -- I was in a similar situation today and successfully recovered the file.

A .txt file I was composing (in Notepad++, but that's beside the point) became corrupted after a lock-up/system freeze. It was the only file to do this (probably because it was the only one I had open at the time). I use Windows XP. The 14,000-line-file had turned into a bunch of NULs. Windows continued to show the correct file size after the incident.

First thing I did was run chckdisk. AFAIK, it didn't help any. I learned about Recuva. I ran it without installing and let it do its deep scan. But after an hour, it had pulled up only 20 or so "complete" "excellent" files that were previously deleted by me and the one I wanted was not among them. I changed advanced settings--which I should have done first time around--to allow the next scan to search for files that were not deleted. I checked the box next to the filename when it came up in the list and hit "recover". Success!!

I got a few days of my life taken away from me today to stress and worry, but I did learn at least one important thing from my ordeal: to backup frequently!

Solution 2

The text data might be present in sectors no longer associated with the filename. If your operating system is Windows, you could try running chkdsk.

If the data is valuable you should stop using the system, boot from a rescue CD and make a backup before using the rescue CD to attempt to retrieve the data. Otherwise any traces of the data that are in unallocated sectors will soon become irretrievably overwritten.

The classic answer is to restore from last night's backups and re-do any changes.

Solution 3

If you've saved a version of that text file earlier, then Previous Versions may be what you're looking for. Right-click the corrupted file and select Properties, then go to the Previous Versions tab. (Vista or newer on NTFS only.)

Even if that doesn't turn up anything, you can open your disk in a sector editor (booted from a CD or USB) and search the raw contents of your HDD for text that you know had been present in the file. You may get lucky.

Share:
30,542

Related videos on Youtube

Justin L.
Author by

Justin L.

Undergrad Physics student.

Updated on September 17, 2022

Comments

  • Justin L.
    Justin L. almost 2 years

    Well, my system crashed as I was saving a text file. When I reopened it, the data was unreadable (shows up as a bunch of ascii NULL characters) I'm guessing that there was a bit or two missing at the beginning of the file or something, and that most of the data is still intact if I just shifted things into the right place. I hope.

    Is there any way to remedy this?

    (I am running Windows Vista)

    • user1686
      user1686 over 13 years
      "Shifting" at bit level doesn't happen -- and even if it did, you wouldn't get a bunch of NULs where you had text.
    • Justin L.
      Justin L. over 13 years
      @grawity what usually causes ASCII NUL characters then?
  • lava
    lava over 2 years
    active Recovery save my time