Dec-09-2020, 01:05 AM
Hi,
I'm trying to find the latest file in a directory but only if a file has a digit in its name.
I globbed the files that have "digit/digits" in the name but after adding "max(fname, key=os.path.getctime)"
The script produces a bunch of errors
.
I'm trying to find the latest file in a directory but only if a file has a digit in its name.
I globbed the files that have "digit/digits" in the name but after adding "max(fname, key=os.path.getctime)"
The script produces a bunch of errors

import os import glob for fname in glob.glob('C:\\02\\*[0-9].*'): print (fname) lt_file = max(fname, key=os.path.getctime) print ("Latest file -->>", lt_file)Thank you.