From f0c81cf52950eb56469c1f9e2de2d348ac4a6223 Mon Sep 17 00:00:00 2001 From: Sebastien Plante Date: Tue, 7 Oct 2025 12:06:11 -0400 Subject: [PATCH] adding some informations about version and stuff --- FoldersToMySQL.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/FoldersToMySQL.py b/FoldersToMySQL.py index 2fcb974..c2fca69 100644 --- a/FoldersToMySQL.py +++ b/FoldersToMySQL.py @@ -4,6 +4,11 @@ import datetime import mysql.connector # 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: # Install python 3.x from https://www.python.org/downloads/ @@ -54,7 +59,7 @@ def list_directories(base_path): try: entries = os.listdir(base_path) except OSError as e: - print(f"Erreur lecture dossier: {e}") + print(f"Error reading directory: {e}") sys.exit(1) dirs = [] for name in entries: @@ -86,9 +91,9 @@ def sync(base_path): conn.commit() print( - f"Synchronisation terminée. Dossiers actifs: {len(current_dirs)}") + f"Synchronization complete. Active folders: {len(current_dirs)}") except mysql.connector.Error as err: - print(f"Erreur MySQL: {err}") + print(f"MySQL error: {err}") finally: cur.close() conn.close() @@ -101,10 +106,10 @@ def main(): base_path = SCAN_PATH if not os.path.isdir(base_path): - print(f"Chemin invalide: {base_path}") + print(f"Invalid path: {base_path}") sys.exit(1) - print(f"Scan dossier: {base_path}") + print(f"Scanning directory: {base_path}") sync(base_path)