From d53b156d27f9991dd07f53ec0fa894eba4ba5d30 Mon Sep 17 00:00:00 2001 From: DIL5 Date: Wed, 4 Nov 2026 15:57:02 +0100 Subject: [PATCH] create target backup directory when needed --- repo_sync.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repo_sync.py b/repo_sync.py index 55c9609..9c79b76 100644 --- a/repo_sync.py +++ b/repo_sync.py @@ -61,6 +61,10 @@ def backup() -> bool: return subprocess.run(cmd, cwd=HOME).returncode == 0 +def make_target_dir(): + return subprocess.run(['ssh', CENTRAL, 'mkdir', '-p', REMOTE_DIR]).returncode == 0 + + def restore() -> bool: # "/./" marks where the relative path starts, so with -R each subtree # lands under $HOME with its original relative path @@ -110,6 +114,7 @@ def cmd_backup() -> None: cwd=HOME, stdout=subprocess.PIPE, text=True, ) threading.Thread(target=reader, args=(watcher,), daemon=True).start() + make_target_dir() try: while True: if watcher.poll() is not None: