I am using FME to produce a number of .xls files and need to rename those files by adding the current date (and time hopefully) to the file name at the end of the process using a shutdown python script. I have cobbled below together from information I have found online but it won't work and I don't have python knowledge to fix it. import os, datetime path='C:\\FME' to_ext='*.xls' for file_name in os.listdir(path): root, ext = os.path.splitext(file_name) t = os.path.getmtime(file_name) v = datetime.datetime.fromtimestamp(t) x = v.strftime( ' %d-%m-%Y') os.rename(os.path.join(path, file_name), os.path.join(path, root+x+to_ext)) I would appreciate any help. Thanks