Все доброго дня. Найдено решение для данной проблемы, но только если у вас имеются предыдущие версии файлов.
$dirVirusRoot = "C:\\Фонтанка"
$dirBackupRoot = "E:\\Строители\\Фонтанка"
$virusString = "
[email protected]_RE819"
$showProcess = $True;
function ReplaceVirusFile ($name) {
if ($name -ne "") {
if ($showProcess) { echo $name }
$goodFile = $name -replace ".$virusString", ""; $goodFile = $goodFile -replace $dirVirusRoot, "";
Copy-Item $dirBackupRoot$goodFile $dirVirusRoot$goodFile 2> $null
if ($?) {
Remove-Item $name
}
}
}
ls -Recurse $dirVirusRoot | Where {$_.name -Match "$virusString*"} | % { ReplaceVirusFile $_.VersionInfo.FileName }