PhotoRec is an amazing little command-line (OK, text menu) utility that is able to recover photos and other file formats from memory cards (provided, of course, you took the sensible route and stopped writing to the card in any way before running it).

Notes

To recover JPEG and RAW files from some Canon models, PhotoRec may require you to select Paranoid : Yes (Brute force enabled) from its options menu - otherwise, it will recover JPEG data without most of the EXIF information.

(with this selected you’ll get a separate JPEG file for each thumbnail - around 16K - but that’s a sensible trade-off)

As a nice bonus, PhotoRec will set the recovered files’ modification date to the original whenever possible, greatly simplifying the process of tracking down what you deleted.