Skip to content

POWERSHELL Еженедельный обновитель #342

Open

Description

@almasabdilda978-jpg

$python = 'C:\Users\almas.abdilda\AppData\Local\Python\pythoncore-3.14-64\python.exe'
$loader = 'C:\Users\almas.abdilda\Documents\Codex\2026-11-18\x20-3-xlsx-14156-x20-4\load_aksay_weekly.py'
$folder = 'C:\Users\almas.abdilda\Documents\PYTHON\Aksay'

$files = @(
Get-ChildItem -LiteralPath $folder -File -Filter '*.xlsx' |
Where-Object { $_.BaseName -match '^\d{1,2}-\d+$' } |
Sort-Object LastWriteTime -Descending
)

if ($files.Count -eq 0) {
throw "В корневой папке Aksay не найдены недельные файлы вида 11-2.xlsx."
}

for ($i = 0; $i -lt $files.Count; $i++) {
Write-Host "$($i + 1). $($files[$i].Name)"
}

$answer = Read-Host 'Введи номер новой недельной выгрузки'
$number = 0

if (-not [int]::TryParse($answer, [ref]$number) -or
$number -lt 1 -or $number -gt $files.Count) {
throw 'Введён неверный номер.'
}

$selectedFile = $files[$number - 1]
Write-Host "Загружаю: $($selectedFile.FullName)"

$env:AKSAY_WEEKLY_FILE = $selectedFile.FullName

try {
& $python $loader

if ($LASTEXITCODE -ne 0) {
    throw "Загрузчик завершился с ошибкой. Код: $LASTEXITCODE"
}

}
finally {
Remove-Item Env:AKSAY_WEEKLY_FILE -ErrorAction SilentlyContinue
}

Activity

  1. changed the title [-]Еженедельный обновитель[/-] [+]POWERSHELL Еженедельный обновитель[/+] on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions