26
Tried using a for loop to rename 500 files and deleted half my data instead
I wrote a quick Python script to batch rename a bunch of photos from my vacation last week, and it ended up overwriting like 250 of them with blank names before I hit Ctrl+C. Turns out I mixed up the source and destination variables in the loop, which meant it was renaming files into each other's spots. Has anyone else had a simple script go totally sideways and lose stuff?
1 comments
Log in to join the discussion
Log In1 Comment
rileygonzalez2d ago
Made this same mistake with a batch of music files last year, ended up with 30 tracks all named "track(1)" or some nonsense. Had to dig through a backup drive to get most of them back, which took way longer than just naming them manually. Maybe it's just me but I always test loops on three dummy files now before letting them run wild.
2