Create rename_months.py
This commit is contained in:
30
rename_months.py
Normal file
30
rename_months.py
Normal 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] )
|
||||||
Reference in New Issue
Block a user