24 lines
882 B
Python
24 lines
882 B
Python
import os
|
|
import subprocess
|
|
|
|
input_dir = "/mnt/gesconrete/gescon"
|
|
condomini_table_names = ["condomini", "condomin", "condomini_totali"] # aggiungi qui se serve
|
|
|
|
def find_all_mdb_files(input_dir):
|
|
for root, _, files in os.walk(input_dir):
|
|
for f in files:
|
|
if f.lower().endswith('.mdb'):
|
|
yield os.path.join(root, f)
|
|
|
|
for mdb in find_all_mdb_files(input_dir):
|
|
for table in condomini_table_names:
|
|
try:
|
|
# Prova a esportare la tabella e conta le righe
|
|
output = subprocess.check_output(
|
|
["mdb-export", mdb, table], stderr=subprocess.DEVNULL
|
|
)
|
|
n_rows = output.decode("utf-8", errors="ignore").count('\n')
|
|
if n_rows > 1: # 1 è solo header, >1 sono dati
|
|
print(f"{mdb} --> {table}: {n_rows-1} righe")
|
|
except Exception:
|
|
continue |