Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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

PREVIOUS NEXT
Code Example
Python :: Removing all non-numeric characters from string in Python 
Python :: python head function show all columns 
Python :: train test validation sklearn 
Python :: all possible substring in python 
Python :: how to remove all characters from a string in python 
Python :: python boxplot legend 
Python :: exclude columns in df 
Python :: remover espaços string python 
Python :: python get financial data 
Python :: how to add and subtract days datetime python 
Python :: how to stop running code in python 
Python :: pass user to serializer django rest framework 
Python :: drop rows with certain values pandas 
Python :: longest substring without repeating characters python 
Python :: np range data 
Python :: greeper 
Python :: how to move a column to last in pandas 
Python :: python string exclude non alphabetical characters 
Python :: how to replace a row value in pyspark dataframe 
Python :: discord python bot require one of two roles for command 
Python :: python reduce function to sum array 
Python :: floyd triangle python 
Python :: how to set index pandas 
Python :: python system of equations 
Python :: replace url with text python 
Python :: how to find columns of a dataframe 
Python :: string to hex python 
Python :: pygame window 
Python :: get gpu name tensorflow and pytorch 
Python :: python read live radio 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =