Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: how to save matplotlib figure to png 
Python :: python convert number to base 
Python :: python read file delete first line 
Python :: supprimer fichier pythpn 
Python :: numpy merge arrays 
Python :: axis font size matplotlib 
Python :: how to plot count on column of dataframe 
Python :: return maximum of three values in python 
Python :: pandas set a column as index 
Python :: sklearn random forest regressor 
Python :: python iterate dictionary in reverse order 
Python :: torch save state dict 
Python :: split a path into all subpaths 
Python :: filter by row contains pandas 
Python :: how to make a blank window open up in python 
Python :: plotly set axes limits 
Python :: python how to make an array of ones 
Python :: python tkinter filedialog folder 
Python :: .fill pygame 
Python :: ImportError: cannot import name ‘json’ from itsdangerous 
Python :: matplotlib insert text 
Python :: install aws sdk ubuntu 20.04 command line 
Python :: python beautifulsoup write to file 
Python :: update my anaconda 
Python :: python discord webhook 
Python :: save pandas dataframe to parquet 
Python :: check if number is power of 2 python 
Python :: get length of csv file with python 
Python :: how to convert a am pm string to 24 hrs time python 
Python :: python get current time without milliseconds 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =