0 points

Find the latest file in folder


dashboard

Wed Oct 28 2020 02:09:48 GMT+0000 (UTC)

Posted 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_copy Copy

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