Snippets Collections
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
star

Wed Oct 28 2020 02:09:48 GMT+0000 (UTC) https://stackoverflow.com/questions/39327032/how-to-get-the-latest-file-in-a-folder-using-python

#python #glob #file #latest

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension