Find the latest file in folder

PHOTO EMBED

Wed Oct 28 2020 02:09:48 GMT+0000 (Coordinated Universal Time)

Saved by @ianh #python #glob #file #latest

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
content_copyCOPY

https://stackoverflow.com/questions/39327032/how-to-get-the-latest-file-in-a-folder-using-python