From 4c11809c4970c958dc4e65d8131dfd1c9a188fff Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 28 Aug 2024 00:21:06 +0200 Subject: [PATCH] Ignore inexistent backup artifacts --- scripts/Windows/Scripts/Restoration.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/Scripts/Restoration.ps1 b/scripts/Windows/Scripts/Restoration.ps1 index b1bd511c..2e6c60a6 100644 --- a/scripts/Windows/Scripts/Restoration.ps1 +++ b/scripts/Windows/Scripts/Restoration.ps1 @@ -146,8 +146,13 @@ $null = New-Module { $dir = New-TemporaryDirectory; $sourcePath = & $pathResolver @PSBoundParameters; + $filePath = Join-Path $dir $sourcePath; 7z x "-o$dir" (Get-ValhallaBackupArchive) $sourcePath @ArgumentList; - Copy-Item -Recurse (Join-Path $dir $sourcePath) $Target; + + if (Test-Path $filePath) { + Copy-Item -Recurse (Join-Path $dir $sourcePath) $Target; + } + Remove-Item -Recurse -Force $dir; } };