diff --git a/openwrt_backup/__init__.py b/openwrt_backup/__init__.py index edac979..5f03dcd 100644 --- a/openwrt_backup/__init__.py +++ b/openwrt_backup/__init__.py @@ -14,7 +14,10 @@ from openwrt_backup.prune import get_all_but_last_n def do_prune(dest_path: Path, n: int, dry, hostname=None): - to_delete = get_all_but_last_n(dest_path, n, hostname) + if dry: + to_delete = get_all_but_last_n(dest_path, n - 1, hostname) + else: + to_delete = get_all_but_last_n(dest_path, n, hostname) for f in to_delete: if dry: print(f"Deleting: {f}")