Skip to content

Commit

Permalink
Skip non-existent directory when restoring
Browse files Browse the repository at this point in the history
  • Loading branch information
enyachoke committed Nov 25, 2024
1 parent 73e1940 commit 9d53138
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/restic_compose_backup/restic.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def restore_files(repository: str, target='/restored_data',mounts={}):

if (restic_exit_code == 0):
for source in mounts.values():
shutil.copytree(f"/restored_data{source['bind']}", source['bind'] , dirs_exist_ok=True)
src_path=f"/restored_data{source['bind']}"
if os.path.exists(dst_path):
shutil.copytree(src_path, source['bind'] , dirs_exist_ok=True)
else:
continue
return restic_exit_code

def backup_db_file(filename: str, backup_command: str):
Expand Down

0 comments on commit 9d53138

Please sign in to comment.