Answers for "python get latest file type in directory"

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)
Posted by: Guest on February-03-2021

Code answers related to "python get latest file type in directory"

Python Answers by Framework

Browse Popular Code Answers by Language