As a photographer who's taken and processed at least 200,000 photos in the past couple decades, you'd think I have a solid workflow that results in zero lost files... but you'd be wrong. 99% of the time, I follow the workflow:
A lot of photographers shoot with two memory cards, and have photos written to both—that way the 2nd card would be a double-failsafe. But for most jobs, I don't do that. And one of my digital cameras doesn't even have two memory card slots, so this isn't an option!
Anyways, more often than I'd like to admit, I do something dumb, like:
This is risky, and maybe one time out of a hundred, it results in me wiping out a portion (or all) the photos I thought I had just imported!
Fortunately for my sake, SD cards and the images stored on them can almost always be recovered, if you know the right tools to use.
Earlier today I did this again, so I thought I'd document exactly how I recover photos using a free and open source tool called PhotoRec . I did this on macOS, but the process is very similar if you're on Linux or Windows:
TeskDisksuite of software, by CGSecurity).
X.Yis the version you downloaded), and click 'Open'
/dev/diskXdrive (whichever one is your SD or microSD card), and press 'Enter'.
..is up one directory, and
.represents the current directory).
Once the directory is selected (after you press
C ), the card will be scanned for recoverable files. This could take some time.
After what could be a very long wait (especially if you're using a 64 GB or larger card, and have a slower reader or cheaper card that can't read as fast), you should see an output directory with tons of images (and often a few other kinds of files):
Hopefully you're good to go! If not, you can re-scan but with 'Whole' if the 'Free' scan didn't work. There are other alternatives, too, but in most cases, if PhotoRec can't recover your images, other alternatives won't work any better.