adding some informations about version and stuff
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user