Studio711.com – Ben Martens

Recover Deleted Files

I’m super careful with files on my computer. Careful almost to the point of obsession. After having a hard drive crash and losing a bunch of data 15+ years ago, I made sure it would never happen again. But recently I broke one of my own rules and ended up in a bit of a mess. The rule is: get your files off of SD cards as soon as possible.

There are bunch of good reasons for this but a few are:

  • SD cards are easy to lose
  • SD cards are easy to damage
  • SD cards are easily corrupted

None of those bit me. The problem that bit me was user error. I left files on the SD card for a couple weeks because I was too lazy to put the card in the computer and copy them over. The exact sequence of mistakes is probably boring to read, but the bottom line is that I thought all of the old photos on the card had already been transferred off but only about 80% of them had. There were a bunch of “first day of school” photos that I hadn’t transferred off right away and I didn’t notice that fact before deleting them.

As soon as it happened, I realized what I had done and my stomach twisted into a knot. I just lost files not because of a software/hardware problem but because I was an idiot.

I immediately ejected the SD card from my computer and slid the lock lever over to prevent any further stupidity. Next it was time to find something to recover the files. When a computer deletes a file, it doesn’t actually overwrite the file, it just removes the entry from the “card catalog” that points to the actual file locations. So if you can carefully scan the disk and you know what the binary header of your file looked like, you can still read the old data.

If you search around for “recover lost files” there are tons of programs available and I believe two things are generally true:

  1. They’re going to cost quite a bit of money because they know you’re panicked.
  2. It’s a great way for hackers to get you to install spyware/viruses. You’re in a hurry and you click away without really checking the validity of the site.

I ended up using PhotoRec which is free, open source, and hopefully safe. It’s not very user friendly, but that was fine with me.

The tool worked ok, but it didn’t find any files on my first scan. I had only saved .CR2 (Cannon Raw) files and the tool didn’t have a scanner for those files included out of the box. Thankfully they allow you to add your own file signatures, so I whipped open a hex editor, figured out what the header of a CR2 file looks like and added a new signature.

After that it quickly plowed through my SD card and found the “deleted” files. It didn’t get 100% of them, but because I took about 100 pictures of Elijah in ~4 different poses, I still had plenty of good photos to choose from. The day was saved.

But this is one of those lessons that I’ll never forget. When you walk in the door with new pictures on your SD card, immediately copy them to your computer and get them backed up to cloud storage. And whenever I buy my next camera body, I’ll probably be buying one that has built-in WiFi syncing available. I might even check out those WiFi SD cards to see if they’re worth it.