A file deleted from a laptop SSD may only have minutes before being gone, but I wouldn’t say minutes is a schedule I’d rely on. It’s going to depend on the drive, the OS, workload, and whether TRIM is even enabled. I couldn’t find anything that said every SSD has the same countdown, and the valuable observation is that waiting and working on the machine can decrease the chances of recovery rapidly.
I used to think that when a file is deleted, the drive erases it right away, but that’s not how normal operations work. When you delete a file, the OS removes bookkeeping information that told it where the file was located, and marks those sectors as available space. What was previously there could theoretically remain until something else needs to be written there.
This also explains a phenomenon that seems unrelated, but isn’t. The OS doesn’t have to rewrite all of the file contents before removing the pointer to it. That’s why huge files don’t take appreciably longer to delete than small ones; it only has to remove the directory entry.
The real problem is continued writing
Once a file is deleted, I would stop using the drive entirely. I wouldn’t even go to a recovery website and try downloading recovery software while deciding what to do next. It’s not just the downloads that count as writing, but normal use would do it too; web browsers generate data when they run, temporary files, updates, and the OS itself may generate logs and other information as part of normal operation. Any of these could potentially overwrite parts of the file contents that were just deleted, and I can’t predict what’s going to happen.
If the files were on the system partition, I would power the machine off entirely. Trying to recover files from an SSD while it’s actively being used by the OS is a bad idea, because the OS can allocate space normally, without considering that something might have been there before. Instead perform the recovery from another machine, or from a USB stick - mount the affected drive as secondary storage and run recovery tools from the first.
The tools aren’t magical; they have to scan the drive for recoverable data. They might find whole files, with original names and directory structure, if the deletion was recent and no significant amount of data has been written since then. I wouldn’t say the results are guaranteed, though; It depends on what information about the file has survived the deletion.
If the space the file was using has been reallocated, then whatever wrote to it last might have damaged the contents. If the directory entry was deleted, but the file contents survived, then the recovery tool might have found the file with no name. In that scenario, the file and its information about itself had different results.
Storage type changes the odds
Backups are going to be more important than recovery software. Recovery software is for when you already lost something, and no recovery scan is going to find every single bit of data with 100% accuracy. Having those folders backed up somewhere else would make recovering from accidental deletion as simple as restoring from that backup, and if the backup is automated and the folders are designated, this could be as simple as waiting two minutes for the data to copy over.
It’s the margin that matters. Not every storage type handles lost data the same way. Mechanical disks tend to be more forgiving, since writing to a portion of the disk where something previously was just overwrites it. Memory cards and USB sticks behave similarly, which is why a photo you deleted yesterday from your camera may still be there if you don’t use the card again. They’re not immune, but both of those types of storage have significantly more predictable behavior than an SSD.
Modern operating systems usually issue a TRIM command after deleting a file, which advises the SSD to mark those blocks of memory as empty. After that, when the SSD decides to perform a block erase as part of normal operations, those contents will be gone. As far as I could tell, there isn’t a period of time after TRIM that reliably predicts when those blocks will be wiped - it may happen quickly, or it may happen never.