Код:

param(
[Parameter(Mandatory = $true)][System.String]$SourceFile,
[System.String]$sCHUNKFolder = 'C:\Мои проекты\0167\CHUNK'
)
$aByte4Find = [System.Byte[]](0xFF, 0xFF, 0xFF, 0xFF)
if(Test-Path -Path $SourceFile -PathType Leaf) {
$oSourceFile = [System.IO.FileInfo]$SourceFile
if(Test-Path -Path $sCHUNKFolder -PathType Container) {
Write-Host "[$($oSourceFile.FullName)]" -ForegroundColor Yellow
$aByteContent = [System.IO.File]::ReadAllBytes($oSourceFile.FullName)
$iCount = 0
for($i = 0; $i -le $aByteContent.Length - $aByte4Find.Length - 1; $i++) {
$bFound = $true
for($j = 0; $j -le $aByte4Find.Length - 1; $j++) {
if($aByteContent[$i + $j] -ne $aByte4Find[$j]) {
$bFound = $false
break
}
}
if($bFound) {
$sFoundFileName = [System.BitConverter]::ToString($aByteContent[$($i - 16) .. $($i - 1)]) -replace '-', ''
Write-Host "`tOffset: $i"
Write-Host "`tFound file name: $sFoundFileName"
$cChunkFiles = @(Get-ChildItem -Path "$sCHUNKFolder\$sFoundFileName.chunk" -File -Recurse)
if($cChunkFiles.Count) {
$iCount++
$jCount = 0
$cChunkFiles | ForEach-Object -Process {
$jCount++
$sDestFileName = "$($oSourceFile.BaseName)_$($iCount.ToString("00"))_$($jCount.ToString("00")).chunk"
Write-Host "`tFile [$($_.FullName)] found!" -ForegroundColor Green
Write-Host "`tCopy to [$($oSourceFile.DirectoryName)] as [$sDestFileName]." -ForegroundColor Green
[System.IO.File]::Copy($_.FullName, "$($oSourceFile.DirectoryName)\$sDestFileName", $true)
}
} else {
Write-Host "`tFile(s) [$sFoundFileName.chunk] not found in folder [$sCHUNKFolder]!" -ForegroundColor Red
}
Write-Host ''
}
}
} else {
Write-Host "Can't find CHUNK folder [$sCHUNKFolder]." -ForegroundColor Red
}
} else {
Write-Host "Can't find source file [$SourceFile]." -ForegroundColor Red
}
Write-Host 'Press Enter to close...' -NoNewline; Read-Host | Out-Null