init
This commit is contained in:
@@ -5,6 +5,7 @@ import matplotlib.pyplot as plt
|
|||||||
import datetime
|
import datetime
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
from matplotlib import rc
|
from matplotlib import rc
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import copy
|
import copy
|
||||||
@@ -1072,7 +1073,15 @@ if __name__ == "__main__":
|
|||||||
if not os.path.isdir(outPath):
|
if not os.path.isdir(outPath):
|
||||||
os.mkdir(outPath)
|
os.mkdir(outPath)
|
||||||
day = datetime.today().strftime("%Y%m%d")
|
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)
|
outPath = os.path.join(outPath, day)
|
||||||
|
|
||||||
if os.path.isdir(outPath):
|
if os.path.isdir(outPath):
|
||||||
shutil.rmtree(outPath)
|
shutil.rmtree(outPath)
|
||||||
os.mkdir(outPath)
|
os.mkdir(outPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user