sync-from-remote.ps1 703 B

123456789101112131415
  1. param(
  2. [Parameter(Mandatory=$true)][string]$RemoteSource,
  3. [Parameter(Mandatory=$true)][string]$Destination,
  4. [Parameter(Mandatory=$true)][string]$ExpectedSha256,
  5. [Parameter(Mandatory=$true)][string]$RemoteWorker,
  6. [ValidateRange(65536,268435456)][int]$ChunkBytes = 1048576,
  7. [ValidateRange(0,5)][int]$Retries = 5,
  8. [switch]$Replace
  9. )
  10. $ErrorActionPreference='Stop'
  11. $arguments=@('--remote-worker',$RemoteWorker,'--chunk-bytes',$ChunkBytes,'--retries',$Retries)
  12. if($Replace){$arguments+='--replace'}
  13. $arguments+=@('download',$RemoteSource,$Destination,'--expected-sha256',$ExpectedSha256)
  14. & python (Join-Path (Split-Path -Parent $PSScriptRoot) 'remote_transfer.py') @arguments
  15. exit $LASTEXITCODE