python get last modified file in directory code example
Example 1: python get newest file in directory
import glob
import os
list_of_files = glob.glob('/path/to/folder/*') # * means all if need specific format then *.csv
latest_file = max(list_of_files, key=os.path.getctime)
print(latest_file)
Example 2: python get last modification time of file
import os
time = os.path.getmtime("file.txt")
print(time) # 1600113737.82