Загрузка данных



$dir = "$env:USERPROFILE\Desktop\LR4"
$sevenZip = "$env:ProgramFiles\7-Zip\7z.exe"
$archive = "$dir\LR4_transport_AES256.zip"
$password = "LR4-Transfer!26"

# Find newest Word and Excel documents
$word = Get-ChildItem $dir -Filter "*.docx" -File |
    Sort-Object LastWriteTime -Descending |
    Select-Object -First 1

$excel = Get-ChildItem $dir -Filter "*.xlsx" -File |
    Sort-Object LastWriteTime -Descending |
    Select-Object -First 1

$pdf = "$dir\LR4_FINAL_PROTECTED.pdf"

if (-not $word) { throw "DOCX not found in LR4" }
if (-not $excel) { throw "XLSX not found in LR4" }
if (-not (Test-Path $pdf)) { throw "PDF not found" }
if (-not (Test-Path $sevenZip)) { throw "7-Zip not found" }

Write-Host "Files found:" -ForegroundColor Cyan
Write-Host "WORD:  $($word.Name)"
Write-Host "EXCEL: $($excel.Name)"
Write-Host "PDF:   $(Split-Path $pdf -Leaf)"

# Create encrypted ZIP
if (Test-Path $archive) {
    Remove-Item $archive
}

& $sevenZip a -tzip -mem=AES256 "-p$password" `
    $archive $word.FullName $excel.FullName $pdf

if ($LASTEXITCODE -ne 0) {
    throw "Archive creation failed"
}

# Verify ZIP
& $sevenZip t "-p$password" $archive

if ($LASTEXITCODE -ne 0) {
    throw "Archive verification failed"
}

Write-Host ""
Write-Host "SUCCESS! AES-256 archive created" -ForegroundColor Green
Write-Host "Password: $password"

explorer.exe $dir