| 123456789101112131415161718 |
- param(
- [Parameter(Mandatory=$true)][string]$Source,
- [Parameter(Mandatory=$true)][string]$RemotePartial,
- [Parameter(Mandatory=$true)][string]$RemoteWorker,
- [ValidateRange(65536,268435456)][int]$ChunkBytes = 1048576,
- [ValidateRange(0,5)][int]$Retries = 5,
- [switch]$Replace
- )
- $ErrorActionPreference='Stop'
- [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
- $OutputEncoding = [Console]::OutputEncoding
- if(-not $RemotePartial.EndsWith('.partial')){throw 'REMOTE_PARTIAL_SUFFIX_REQUIRED'}
- $destination=$RemotePartial.Substring(0,$RemotePartial.Length-8)
- $arguments=@('--remote-worker',$RemoteWorker,'--chunk-bytes',$ChunkBytes,'--retries',$Retries)
- if($Replace){$arguments+='--replace'}
- $arguments+=@('upload',$Source,$destination)
- & python (Join-Path (Split-Path -Parent $PSScriptRoot) 'remote_transfer.py') @arguments
- exit $LASTEXITCODE
|