Untitled

 avatar
unknown
plain_text
a month ago
520 B
2
Indexable
$FileDownloaded = $false
while (-not $FileDownloaded) {
    if (Test-Path $DestinationPath) {
        # Get the initial file size
        $InitialSize = (Get-Item $DestinationPath).Length
        Start-Sleep -Seconds 2
        # Get the size again after a short delay
        $NewSize = (Get-Item $DestinationPath).Length
        if ($InitialSize -eq $NewSize) {
            # File size is stable, download likely complete
            $FileDownloaded = $true
        }
    } else {
        Start-Sleep -Seconds 1
    }
}
Leave a Comment