Windows用
ファイル削除・ファイル検索・ファイル日付取得
ダウンロードフォルダからCSVファイルのパス一覧を取得する
from datetime import datetime
from glob import glob
import os
# Windows ダウンロードパス
path = os.path.expanduser('~\Downloads')
# ファイルパス取得
for filepath in glob(path + "\\*.csv"):
print(filepath)
# 更新日時を取得
tm = os.path.getmtime(filepath)
# to datetime
tm_datetime = datetime.fromtimestamp(tm)
# to string
tm_string = tm.strftime('%Y-%m-%d %H:%M:%S')
print(tm_string)
