def get_latest_file(path, *paths):
    """Returns the name of the latest (most recent) file 
    of the joined path(s)"""
fullpath = os.path.join(path, *paths)
files = glob.glob(fullpath)
if not files:
    return None
latest_file = max(files, key=os.path.getctime)
_, filename = os.path.split(latest_file)
return filename
Как получить последний файл в папке с помощью python