15
Warning: My first attempt at a Python script deleted a whole folder of vacation pics.
I was in my home office trying to automate renaming some files, but I messed up the path in my os.remove() loop and wiped my '2023_Trip' directory instead, so now I'm asking if anyone has a solid backup method for new coders before they try file operations?
3 comments
Log in to join the discussion
Log In3 Comments
max2231d ago
That's a rough way to learn about paths. Honestly though, how many pictures are we talking? You can probably get most of them back from the cloud or your phone if you sync photos. My old phone automatically backs up everything to Google Photos without me doing a thing.
8
gibson.morgan1d ago
My backup rule is to never run a delete script on the original files. I first copy the folder and run the script on the copy, so the worst case is a messed up duplicate. It adds a step but saves the heartache.
5
martin.riley1d ago
Ouch, that hurts just reading it (I've definitely nuked a test folder or two myself). For a simple backup, I just use a free tool that copies my important stuff to an external hard drive every Sunday night. The key is making it automatic so you don't forget.
4