Add scripts for restoring files

This commit is contained in:
Manuel Thalmann 2023-06-22 18:44:31 +02:00
parent b4dd114ba4
commit c45a659aaa
2 changed files with 12 additions and 0 deletions

View file

@ -55,5 +55,7 @@ function Invoke-WindowsRestore([Context] $context) {
$context.Restore($backupPath, $context.BackupRoot());
}
Invoke-FileRestore $context;
Remove-Item -Recurse $context.RootDir;
}

View file

@ -16,3 +16,13 @@ function Invoke-FileBackup([Context] $context) {
$context.Backup($candidate[1], $context.FileArchivePath($candidate[0]), $candidate[2]);
}
}
function Invoke-FileRestore([Context] $context) {
foreach ($candidate in Get-BackupCandidates) {
$archivePath = $context.FileArchivePath($candidate[0]);
if (Test-Path -PathType Leaf $archivePath) {
$context.Restore($archivePath, $candidate[1]);
}
}
}