Streamline restoration of directories

This commit is contained in:
Manuel Thalmann 2024-08-28 04:38:30 +02:00
parent a54c44be90
commit e671592fc4

View file

@ -157,7 +157,12 @@ $null = New-Module {
7z x "-o$dir" (Get-ValhallaBackupArchive) $sourcePath @ArgumentList; 7z x "-o$dir" (Get-ValhallaBackupArchive) $sourcePath @ArgumentList;
if (Test-Path $filePath) { if (Test-Path $filePath) {
Copy-Item -Recurse (Join-Path $dir $sourcePath) $Target; if (Test-Path -PathType Container $filePath) {
$null = New-Item -ItemType Directory $Target -Force;
$filePath = "$filePath/*";
}
Copy-Item -Recurse $filePath $Target -Force;
} }
Remove-Item -Recurse -Force $dir; Remove-Item -Recurse -Force $dir;