Po importu - úklid


param (

    [Parameter(Mandatory = $true)]

    [string]$SourceFile

)


$TargetDir = Join-Path (Split-Path $SourceFile) "hotovo"

$TargetFile = Join-Path $TargetDir "prenos.mdb"


try {

    if (-not (Test-Path $SourceFile)) {

        throw "Zdrojovy soubor neexistuje: $SourceFile"

    }


    if (-not (Test-Path $TargetDir)) {

        throw "Cilova slozka neexistuje: $TargetDir"

    }


    Copy-Item $SourceFile $TargetFile -Force -ErrorAction Stop

    Remove-Item $SourceFile -Force -ErrorAction Stop

}

catch {

    Write-Error $_

    exit 1

}


exit 0