At one point or another we have all made the mistake of deleting a photo from our camera, or formatting the card before downloading the photos. You may think that the data is lost forever, but most likely it is still there!
When you format a card you are simply creating a new 'file table', which essentially tells your camera that it can now overwrite the old data with new, but the old data is still there in background, waiting to be overwritten by new data. The very important key to recovering your photos is to stop using the card immediately after you deleted/formatted the photos, the longer you go on using it, the more likely it is your 'lost' photos are being overwritten with new ones.
You do need special software to recover the lost data, thankfully it is not expensive, or potentially free.
I went on a search to find the best recovery software at a reasonable price, and I have been exceptionally satisfied with Active@ File Recovery. After you install the software, open it up and insert your sd/cf card. In the left hand panel you will see a list of your hard drives, look for the drive that is most likely labeled 'Removable Drive', expand this drive and you will see the local disk, click on this to select it.
If you only deleted the files on your camera rather than formating, click the 'QuickScan' button in the toolbar. You should then see folders like System Volume and DCIM, if you see DCIM, click on this and go into the folder, you should now see your missing files in the right pane. Below you can see the first two files were deleted on camera, and the attribute is set to DA, select these files and click 'Recover' in the toolbar, a new dialog will open asking you where to save the files.
If you formatted the card, don't get scared yet. Most likely the information is still there, but it will require a 'SuperScan' which will take a bit longer to perform.
To start the SuperScan select your card in the left panel and click 'SuperScan' in the toolbar, an options window will come up, click on the 'Signature Recognition' tab and uncheck all file formats except 'Camera Raw Files' (assuming you are shooting in raw), you can even drill down to your specific file format to make the scan even faster.
Click 'Scan' and grab a beer....
When the SuperScan has completed you will see 'Signature Files' in the left panel, and the resulting file types in the right panel, expand 'Camera Raw Files', then expand your file format (nef, cr2, raf, etc.) and you will see a list of all the files that remain on the card, these are your photos! You do lose the file name with SuperScan, but at least you will recover your files. Select the files you think you need to recover based upon the created date, now click the Recover button in the toolbar, another window will open asking you where to save the recovered files, click Recover and your files should be saved to this new location. You may be surprised how much information is still on your card, this particular card had files from 2014!
This is another option that may have come free with your Sandisk card, but if you threw away the original packaging you're out of luck and would have to pay $40 to purchase it, which I do not recommend.
This software does work, but it is painfully slow and you lose the original file names (they will be numbered 1.jpg, 2.jpg, etc.). I would only use this software if you have the free version that came with your card and want to save $30
Have a corrupted card?
Good news, using the same methods/software above should allow you to recover the files off the card. Barring physical damage to the card, most data is recoverable.