This commit is contained in:
2026-02-18 13:48:27 +01:00
parent f374bdb023
commit e5bf95e4fa
8 changed files with 144 additions and 320 deletions
+15
View File
@@ -0,0 +1,15 @@
# core/backup.py
import os
import shutil
from core.paths import get_project_root
def move_to_backup(path):
"""Mueve un archivo al directorio centralizado /backup."""
root = get_project_root()
backup_dir = os.path.join(root, "backup")
os.makedirs(backup_dir, exist_ok=True)
target = os.path.join(backup_dir, os.path.basename(path))
shutil.move(path, target)
return target
+7
View File
@@ -0,0 +1,7 @@
# core/paths.py
import os
def get_project_root():
"""Devuelve la ruta donde está main.py."""
return os.path.dirname(os.path.abspath(__file__ + "/.."))