25
My first Python script deleted a whole folder of vacation photos before I hit Ctrl+Z
I was working late at my kitchen table, writing a script to clean up old text files. I mixed up the path variable and pointed it at my 'Pictures' folder instead. The script ran and wiped about 200 photos from my trip to Seattle last year in a second. I felt my stomach drop. I found a free file recovery tool called Recuva online and, after an hour of panic, got almost all of them back. Has anyone else had a close call like that with a simple mistake in their code?
3 comments
Log in to join the discussion
Log In3 Comments
the_ruby2mo ago
Did you test the script on a dummy folder first? That's a brutal way to learn about dry runs. Always makes me triple-check the path now. What was the recovery process like, was it straightforward or a total nightmare?
7
milar462mo ago
You didn't do a dry run first?
3
sage_morgan751mo ago
But did you learn anything from that, or did you just chalk it up to bad luck and move on? I've seen way too many people make the exact same mistake twice because they never bothered to build safety checks into their workflow. A simple "is this the right folder" prompt before deletion would have saved you that hour of panic.
4