Le script
from pathlib import Path
import shutil
SIMULATION = True
TYPES = {"Images": {".jpg", ".png", ".webp"}, "Documents": {".pdf", ".docx", ".odt"},
"Archives": {".zip", ".7z"}, "Installateurs": {".exe", ".msi"}}
dossier = Path.home() / "Downloads"
for f in dossier.iterdir():
for nom, exts in TYPES.items():
if f.is_file() and f.suffix.lower() in exts:
print(f"{f.name} → {nom}/")
if not SIMULATION:
(dossier / nom).mkdir(exist_ok=True)
shutil.move(str(f), dossier / nom / f.name)
Renommer avec la date
from datetime import datetime
for f in Path("Photos").glob("*.jpg"):
d = datetime.fromtimestamp(f.stat().st_mtime).strftime("%Y-%m-%d_%H%M%S")
f.rename(f.with_name(f"{d}{f.suffix.lower()}"))Attention aux doublons de noms (ajouter un compteur). Testez sur une copie. Planifier : Planificateur de tâches ou cron.