Saturday, April 18, 2009

How to re-recover your files (mp3, etc...) after recovering from a bad damage

The recovery mentioned above means to crop out the excessive bits added to the begining of the file, probably after a system recovery. This was a true experience, that I had about an year back. I had a hard disk crash, so that all the data is gone. Finally I was able to recover the files, but with some arbitrary size of bits appended front of some (majority of) files.
There is a simple and more straight forward solution. That is to use a hex editor, and open each file with the editor, then delete the junk bits and save the file. It will be hell a lot of pain, if you are going to follow above method, since there may be several thousands of files to be edited. (Actually in the first place, I was determined to follow this method. Eventually I realised the silliness after couple of days :D)
Therefore I came up with a simple C++ programme to get the job done. I thought of sharing it with you, so that it may help you out in some case :). The programme was implemented to be used in Windows platform, but it could be worked out to run on UNIX without much of a pain.
In the current version, the executable should be moved to the directory that contains the set of corrupted files and directories containing them. Then run the programme using command prompt. It will recover the files in the current directory as well as iteratively the sub-directories.
The programme is written in such a way that it will remove all the bits before the file type's header tag. In this case it will cure only one file type at a run. But feel free to change the code according to your wish and to make your own recovery programme.
You can get the source code from here

2 comments:

  1. hi friend,

    Its a nice to hear that we nolonger need modificatons with hex editor each file..

    Well done. U save a lot of time.. Keep it up..

    ReplyDelete
  2. අනේ පලයන් බන් යන්න දාස! එළ වැඩේ මචන් වරුණ්. කෙලින් කරල තියාගනින් (Keep it up!)

    ReplyDelete