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 :: list loop python 
Python :: python GOOGLE_APPLICATION_CREDENTIALS 
Python :: WARNING: Ignoring invalid distribution -ip 
Python :: how to plotting horizontal bar on matplotlib 
Python :: python check if type 
Python :: add headers tp requests python 
Python :: grab a href using beuatiful soup 
Python :: python get nth letter of alphabet 
Python :: drop row based on NaN value of a column 
Python :: distribution seaborn 
Python :: set password on a zip file in python 
Python :: select all columns except one pandas 
Python :: how to get seconds from datetime in python 
Python :: python get random character from string 
Python :: Tkinter button icons 
Python :: python random word 
Python :: python program to count vowels in a string 
Python :: python number divisible by two other numbers 
Python :: boxplot pandas 
Python :: logging in with selenium 
Python :: run python file in interactive mode 
Python :: bot ping discord.py 
Python :: print hello world in python 
Python :: how to get all folders on path in python 
Python :: __gt__ 
Python :: Get a random joke in python 
Python :: load saved model tensorflow 
Python :: Converting utc time string to datetime object python 
Python :: cast tensor type pytorch 
Python :: read live video from usb opencv python 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =