JJ

Authored Comments

Thanks for the interesting article.
How would I list all the pseudo terminal devices?

Great article showing how simple little bit of python code could help you solve a brain numbing problem.
Only one thing I would change is to add a check to only rename CSV files.

Sorry but the formmating did not want to work

=========
import os, shutil

monthMapping = {'Jan': '1', 'Feb': '2', 'Mar': '3', 'Apr': '4', 'May': '5', 'Jun': '6', 'Jul': '7', 'Aug': '8', 'Sep': '9', 'Oct': '10', 'Nov': '11', 'Dec': '12'}

for filename in os.listdir("./"):
if filename.endswith(".csv"):
monthPart = filename[:3]
yearPart = filename[3:7]
newFilename = yearPart + '_' + monthMapping[monthPart] + '.csv'
print('Renaming ' + filename + ' to ' + newFilename)
shutil.move(filename, newFilename)

===========