- 2

Hi. Can anybody give me a piece of advice with file renaming?

The quest is: there is a folder with over 300 mp3 files. I want to write a program by Python to rename each file using random letters. Any ideas what to start with?

21st Nov 2017, 2:02 AM
Yuri Shelkov
Yuri Shelkov - avatar
5 Answers
+ 3
I don't think it is possible. Don't be lazy!
21st Nov 2017, 2:13 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
@yuri neither lazy nor stupid does it work? looks good!
21st Nov 2017, 3:34 AM
Oma Falk
Oma Falk - avatar
21st Nov 2017, 3:10 AM
Oma Falk
Oma Falk - avatar
+ 1
Works pretty good
21st Nov 2017, 6:42 AM
Yuri Shelkov
Yuri Shelkov - avatar
0
Lazy is better than stupid. Thanks anyway. Just take a look. import os path = input("Path: ") for i, filename in enumerate (os.listdir+path)): os.chdir(path) os.rename(filename,'somename{}.mp3'.format(i+1)
21st Nov 2017, 3:28 AM
Yuri Shelkov
Yuri Shelkov - avatar