SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def last_modified_file(folder):
  2.     import glob
  3.     import os
  4.  
  5.     if folder[-1] == '/':
  6.         folder = folder[:-1]
  7.  
  8.     list_of_files = glob.glob(f'{folder}/*') # * means all if need specific format then *.csv
  9.     latest_file = max(list_of_files, key=os.path.getctime)
  10.     return latest_file
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top