2021年10月11日 星期一

[Python] 計算RMT檔案目錄下的檔案數

 #!/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)

2021年10月10日 星期日

[HTML] bootstrap5 與 chart.js (v3)

最近預計會有一些製作網頁的需求, 學著用 bootstrap5 chart.js, 碰到一些問題, 上網搜尋解答, 解決後做個紀錄