9
My first Python script deleted my homework folder
I was in my dorm room trying to automate moving some files. I wrote a script that was supposed to move only .txt files from my desktop to a new folder. I ran it and my entire 'Schoolwork' folder just vanished. I panicked for a solid hour before I found the 'shutil' module documentation and learned I'd used 'shutil.move' on the wrong path. I managed to get it back from the recycle bin. Has anyone else accidentally nuked a folder with a bad line of code?
2 comments
Log in to join the discussion
Log In2 Comments
murray.gray8d ago
Actually seems like a basic learning step. Everyone should test scripts on dummy folders first. That's just common sense with file operations.
9
saraho488d ago
Common sense isn't so common, @murray.gray, but testing on dummy data is still vital.
7