컴퓨터/Python
python 사용자 Downloads 폴더에 생성일자 오늘인 파일 출력하기
풍경소리^^
2023. 12. 13. 09:31
import os
import time
now = time.strftime("%Y-%m-%d")
home_path = os.path.expanduser('~')
base_path = os.path.join(home_path,"Downloads")
# base_path = "C:/Users/newstep/Downloads"
for filename in os.listdir(base_path):
c_time = time.gmtime(os.path.getctime(os.path.join(base_path, filename)))
creation_date = time.strftime("%Y-%m-%d",c_time)
if now == creation_date:
print(filename)