From cc59087b8ca9ffc99d476025e730fcb6ecedaa20 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 17 Sep 2024 17:48:20 +0200 Subject: [PATCH] restic_restore: extends restic.restore to use multiple --include paths --- backupbot.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backupbot.py b/backupbot.py index 88534b2..d567ff5 100755 --- a/backupbot.py +++ b/backupbot.py @@ -138,6 +138,15 @@ def restore(snapshot, target, noninteractive): logger.debug(result) +def restic_restore(snapshot_id='latest', include=[], target_dir=None): + cmd = restic.cat.base_command() + ['restore', snapshot_id] + for path in include: + cmd.extend(['--include', path]) + if target_dir: + cmd.extend(['--target', target_dir]) + return restic.internal.command_executor.execute(cmd) + + def get_snapshots(snapshot_id=None, app=None): if snapshot_id and snapshot_id != 'latest': snapshots = restic.snapshots(snapshot_id=snapshot_id)