wanna rename them all so the name would only only include the "name" section. I tried the code below:
import os
for filename in os.listdir('.'):
parts = filename.split('-')
new_name = parts[2] + '.flac'
os.rename(filename, new_name)
but it gives me an error: index out of range. What should I do?
Please format the code you posted, by wrapping it in triple backticks. -> `
Sent it the linux group first, sry
Actually the parts should have 4 elements. But it says it doesn't
man rename
Обсуждают сегодня