Test


import pyodbc import os import pandas as pd

from configparser import ConfigParser

desktop_path = os.path.normpath(os.path.expanduser("~/Desktop")) config = ConfigParser() config_file = desktop_path + "\read_ini.ini" config.read(config_file, 'cp932') db_path = config.get('baseconf', 'db_path') work_path = config.get('result', 'floder') hcsv_path = work_path + "\本体" gcsv_path = work_path + "\グループ"

conn_str = ( r'DRIVER={Microsoft Access Driver (.mdb, .accdb)};' f'DBQ={db_path}' )

cnxn = pyodbc.connect(conn_str) with cnxn.cursor() as crsr: crsr.execute(r"DELETE FROM [申請書出力(データ)];") crsr.execute(r"DELETE FROM [申請書出力(G会社)];")

cur = cnxn.cursor() cur.execute("INSERT INTO [申請書出力(データ)] " + \ " SELECT *" + \ rf" FROM [text;HDR=Yes;FMT=Delimited(,);Database={hcsv_path}].csv_merge_OK_new.csv t") cnxn.commit()

cur.execute("INSERT INTO [申請書出力(G会社)] " + \ " SELECT *" + \ rf" FROM [text;HDR=Yes;FMT=Delimited(,);Database={gcsv_path}].csv_merge_OK_new.csv t") cnxn.commit()

cnxn.close()


import os

def visitDir(path): if not os.path.isdir(path): print('Error: "', path, '" is not a directory or does not exist.') return else: global x try: for lists in os.listdir(path): sub_path = os.path.join(path, lists) x += 1 print('No.', x, ' ', sub_path) if os.path.isdir(sub_path): visitDir(sub_path) except: pass

if name == 'main': x = 0 visitDir(r'C:\Users\tooladmin\Desktop\Input_通常サプライヤ') print('Total Permission Files: ', x)