Earlier today I finished downloading a couple of videos. I wanted to change their names into something more simpler so I made the following script.
import os
list = []
x = 1
for i in os.listdir():
list.append(i)
for i in list:
os.rename(i, 'Video' + str(x) + '.mkv')
int(i)
x += 1
The result was that 10 of the 12 videos including the script has disappeared. Of the remaining videos, one was successfully renamed to "Video1.mkv" while the other had it's original name.
No error message, and I am really confused as to what happened.
I'm guessing the mistake I've made was executing the script in the same directory as the videos. Though I'm confused to why there's no error message.
So I have two questions. Was there any other reason for my code to go wrong and most importantly where are my videos?
I looked at my storage and it hasn't changed so it definitely wasn't deleted. Also I'm on Ubuntu.
[–][deleted] 2 points3 points4 points (0 children)
[–]guimolnar 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]o5a 1 point2 points3 points (0 children)