Answers for "get most recent file in directory python"

0

get most recent file in directory python

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)
Posted by: Guest on August-16-2021

Code answers related to "get most recent file in directory python"

Python Answers by Framework

Browse Popular Code Answers by Language