rozdeleni do struktury

This commit is contained in:
JiriUhlir
2026-05-27 12:15:11 +02:00
parent 12f6323185
commit 2b20444324
14 changed files with 749 additions and 661 deletions
+25
View File
@@ -0,0 +1,25 @@
from pathlib import Path
from .config import DEFAULT_BACKUP_DIR, read_env_value
def backup_dir() -> Path:
return Path(read_env_value("BACKUP_DIR", DEFAULT_BACKUP_DIR))
def list_backups():
path = backup_dir()
if not path.exists():
return []
return sorted(
path.glob("*.tar.gz"),
key=lambda p: p.stat().st_mtime,
reverse=True,
)
def is_backup_path(path: Path) -> bool:
target = path.resolve()
root = backup_dir().resolve()
return root in target.parents and target.suffixes[-2:] == [".tar", ".gz"]