#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 11 08:55:28 2021
@author: ghosty
"""
from os import listdir
from os.path import isfile, isdir, join
from datetime import datetime, timedelta
# 指定要列出所有檔案的目錄
root_path = "E:\\RMT Processing\\Source\\"
def getFileCount(path):
count = 0
files = listdir(path)
#print(files)
for f in files:
#print(f)
fullpath = join(path, f)
if isfile(fullpath):
count += 1
return count
start_data = datetime(2021, 10, 2)
stop_data = datetime(2021, 10, 10)
search_date = start_data
while (search_date <= stop_data):
for hour in range(24):
searth_path = root_path + search_date.strftime("%Y-%m-%d") + '\\{:0>2}'.format(hour)
count = getFileCount(searth_path)
if (count<700 or count>720) :
print(searth_path+': filecount=', count)
search_date += timedelta(days=1)
留言列表