- Use Sorted with a key for getmtime
- pop off the last one and that is your file
import os,glob my_xlsm = sorted(glob.glob(r"C:\Users\jibsheet\Downloads\Sample*.xlsm"), key=os.path.getmtime ) latest_xlsm = my_xlsm.pop()
Howto's, Observations, and stuff
import os,glob my_xlsm = sorted(glob.glob(r"C:\Users\jibsheet\Downloads\Sample*.xlsm"), key=os.path.getmtime ) latest_xlsm = my_xlsm.pop()