This commit is contained in:
dsyoon
2022-12-18 19:06:08 +09:00
parent 80ebd0a617
commit 0bb01bec21

View File

@@ -5,6 +5,7 @@ import matplotlib.pyplot as plt
import datetime
import sqlite3
from datetime import datetime
from dateutil.relativedelta import relativedelta
from matplotlib import rc
import pandas as pd
import copy
@@ -1072,7 +1073,15 @@ if __name__ == "__main__":
if not os.path.isdir(outPath):
os.mkdir(outPath)
day = datetime.today().strftime("%Y%m%d")
before_7_day = datetime.today() + relativedelta(days=-7)
dayList = os.listdir(outPath)
for dayDir in dayList:
if dayDir[0] != '.' and dayDir < before_7_day.strftime("%Y%m%d"):
if os.path.exists(os.path.join(outPath, dayDir)):
shutil.rmtree(os.path.join(outPath, dayDir))
outPath = os.path.join(outPath, day)
if os.path.isdir(outPath):
shutil.rmtree(outPath)
os.mkdir(outPath)