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: