Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_latest_file(directory):
- files = [os.path.join(directory, f) for f in os.listdir(directory)]
- files = [f for f in files if os.path.isfile(f)]
- latest_file = max(files, key=os.path.getctime)
- return latest_file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement