Create rename_months.py

This commit is contained in:
Nico Melone
2023-09-10 11:08:38 -05:00
parent ba6ddfe180
commit c465ada051

30
rename_months.py Normal file
View File

@@ -0,0 +1,30 @@
import os
from os.path import isfile, isdir
path = "/Volumes/home/Photos/Moments/Sorted"
rootlist = os.listdir(path)
print(rootlist)
renameMap = {
"Jan": "01",
"Feb": "02",
"Mar": "03",
"Apr": "04",
"May": "05",
"Jun": "06",
"Jul": "07",
"Aug": "08",
"Sep": "09",
"Oct": "10",
"Nov": "11",
"Dec": "12"
}
for year in rootlist:
if not year == '.DS_Store':
yearFolder = os.listdir(path + "/" + year)
print(yearFolder)
for month in yearFolder:
if not month == '.DS_Store':
#print(path + "/" + year + "/" + renameMap[month])
os.rename(path + "/" + year + "/" + month, path + "/" + year + "/" + renameMap[month] )