Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get last 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.getmtime)
print(latest_file)
Comment

get lastest files from 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.getmtime)
print(latest_file)
Comment

PREVIOUS NEXT
Code Example
Python :: remove dups in list of tuples 
Python :: how to make a grid in python 
Python :: python typing list of possible values 
Python :: how to concatenate two lists in python 
Python :: python length 
Python :: iterating over tuples in python 
Python :: python check if included in list 
Python :: 2d array row and column 
Python :: deleting an object in python 
Python :: python sqlite select column name 
Python :: How to efficiently search for a pattern string within another bigger one, in Python? 
Python :: render django views 
Python :: pandas in python 
Python :: Math Module degrees() Function in python 
Python :: python online practice test 
Python :: python conjugate 
Python :: get schema of json pyspark 
Python :: python print() end 
Python :: python or 
Python :: pandas to csv 
Python :: python calculations with variable x (letter) 
Python :: Install pygmt in Anaconda prompt 
Python :: hex string to hex number 
Python :: python select file in folder given extension 
Python :: sklearn grid search show progress 
Python :: reading csv in spark 
Python :: snakeviz python profile 
Python :: pandas.describe per group 
Python :: facebook python 
Python :: how to find number of categories in python 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =