adding some informations about version and stuff

This commit is contained in:
2025-10-07 12:06:11 -04:00
parent 45f04634ef
commit f0c81cf529

View File

@@ -4,6 +4,11 @@ import datetime
import mysql.connector import mysql.connector
# Version 1.0 # Version 1.0
# Author: Sébastien Plante
# Date: 2025-10-07
# Description:
# This script scans a specified directory for folders and synchronizes their names and last modified dates
# with a MySQL database. It marks folders as inactive if they are no longer present in the directory.
# Requirements: # Requirements:
# Install python 3.x from https://www.python.org/downloads/ # Install python 3.x from https://www.python.org/downloads/
@@ -54,7 +59,7 @@ def list_directories(base_path):
try: try:
entries = os.listdir(base_path) entries = os.listdir(base_path)
except OSError as e: except OSError as e:
print(f"Erreur lecture dossier: {e}") print(f"Error reading directory: {e}")
sys.exit(1) sys.exit(1)
dirs = [] dirs = []
for name in entries: for name in entries:
@@ -86,9 +91,9 @@ def sync(base_path):
conn.commit() conn.commit()
print( print(
f"Synchronisation terminée. Dossiers actifs: {len(current_dirs)}") f"Synchronization complete. Active folders: {len(current_dirs)}")
except mysql.connector.Error as err: except mysql.connector.Error as err:
print(f"Erreur MySQL: {err}") print(f"MySQL error: {err}")
finally: finally:
cur.close() cur.close()
conn.close() conn.close()
@@ -101,10 +106,10 @@ def main():
base_path = SCAN_PATH base_path = SCAN_PATH
if not os.path.isdir(base_path): if not os.path.isdir(base_path):
print(f"Chemin invalide: {base_path}") print(f"Invalid path: {base_path}")
sys.exit(1) sys.exit(1)
print(f"Scan dossier: {base_path}") print(f"Scanning directory: {base_path}")
sync(base_path) sync(base_path)