Recover Images from Corrupt Memory Card

Earlier today I was faced with recovering data from a corrupt Memory Stick Pro card. The camera (a Sony Cybershot) was unable to preview a large number of files and when connecting to a computer, many of the file names and directory names were garbled.

Some image files could still be opened, but around half could not. What I intended to do was copy everything to a local directory on my PC, then use some freeware tools to try and recover as much as possible. Unfortunately, many of the files refused to copy across using Windows Explorer. This made a manual backup very difficult as Windows Explorer will simply give up on the first error when copying a large list. Manually copying every 'healthy' file was out of the question (thousands of images).

I instead decided to write a simple Java program that would recurse through the memory card and copy as many files as it could to a local folder, logging and ignoring any errors. A few minutes later, my first version of the script was compiled and ready to go. On the first run it managed to copy all but 2 files! Much better than doing it manually in Explorer...

Browsing through the local files I noticed that many still had the garbled names and still could not be openend (possibly due to illegal characters in the filenames that Windows couldn't cope with). Renaming the files to something.jpg seemed to magically fix them (i.e. the data was still intact, only the names appeared to be corrupt).

In version 2 of my script I dediced to copy all the files across and rename them to a simple numeric counter. This fixed about 95% of all files. The only issue left was that the images were now out of order.

Version 3 of the script copied the files and extracted the creation time using it as a timestamp for the filenames. This still gave a 95% recovery rate, and most files were now also in correct sequence, except for a small number where the creation times seem to have been corrupted as well (some pictures were dated 2073, etc.).

I was surprised at how well the recovery went. I don't know if this is a common issue with memory cards, but if it happens to you, feel free to give my script a try:

Simply download the MemRec.jar file and double-click to run (or right-click/open-with/Java). Enter the drive letter of your memory card in the first text-box, the location of where you want all the files to be copied to in the second, and hit Recover!

Note the checkbox to rename all files to creation_date.jpg. I recommend leaving this ticked for best results (since filenames are garbled, hard to tell what they should be), although note that if your MC contains videos, these will obviously not be openable as jpgs. What I did was sort the copied files by size and try renaming the large ones to mov/avi/mpg to see if they work, and most did.


  1. Thank you - this worked for me with my Sony camera after numerous software downloads which didn't!


Post a Comment

Popular posts from this blog

Wkhtmltopdf font and sizing issues

Import Google Contacts to Nokia PC Suite

Can't delete last blank page from Word