콘솔워크

파이썬 한 폴더 내에 파일명 + 확장자가 포함된 것중 가장 최근 파일 가져오기 본문

프로그래밍/python

파이썬 한 폴더 내에 파일명 + 확장자가 포함된 것중 가장 최근 파일 가져오기

콘솔워크 2023. 5. 9. 17:53
반응형
def get_download_file(download_folder):
    extension = ".xlsx"
    filename = "itemscout_io"

    excel_files = glob.glob(f"{download_folder}/{filename}*{extension}")
    print(excel_files)

    download_file = max([f for f in excel_files], key=os.path.getctime)
    return download_file

 

반응형