python - Bulk renaming files based on a mapping -


i have txt file mapping of filenames , need them converted to. each old_filename , new_filename different. example mapping looks following:

{matt's resorts owner trust 2015-1 servicer report 06.30.16.xlsx: matt_15-1_201607_servicer report.xlsx,   matt's resorts owner trust 2015-1 servicer report 06.30.16.pdf: matt_15-1_201607_servicer report.pdf,   cap 2012-b 0616.xlsx: cap_12-b_201607_servicer report.xlsx} 

old_filename = matt's resorts owner trust 2015-1 servicer report 06.30.16.xlsx

new_filename = matt_15-1_201607_servicer report.xlsx

i trying write python script looks @ each mapping , renames of files in directory based on above mapping.

i believe should loop looks @ each line , renames each file. have sample code might able help?


Comments