From 48c0ae72276da7c5f6cd5124588ee6024c4d0093 Mon Sep 17 00:00:00 2001 From: dw-0 Date: Mon, 27 Oct 2025 09:30:33 +0100 Subject: [PATCH] fix(backup): allow reusing existing backup directory and enhance copy options --- kiauh/core/services/backup_service.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kiauh/core/services/backup_service.py b/kiauh/core/services/backup_service.py index c48e401..8abdf64 100644 --- a/kiauh/core/services/backup_service.py +++ b/kiauh/core/services/backup_service.py @@ -109,7 +109,16 @@ class BackupService: else: backup_path = self._backup_root.joinpath(backup_dir_name) - shutil.copytree(source_path, backup_path) + if backup_path.exists(): + Logger.print_info(f"Reusing existing backup directory '{backup_path}'") + + shutil.copytree( + source_path, + backup_path, + dirs_exist_ok=True, + symlinks=True, + ignore_dangling_symlinks=True, + ) Logger.print_ok( f"Successfully backed up '{source_path}' to '{backup_path}'"