init
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
||||
import shutil
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from stock.crawler.FnGuideCrawler import FnGuideCrawler
|
||||
from stock.crawler.MetaCrawler import MetaCrawler
|
||||
from stock.crawler.StockCrawler import StockCrawler
|
||||
@@ -69,6 +69,12 @@ if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user