Você pode calcular você mesmo.
Sugiro que você converta seu script no script PowerShell que usa o assembly WinSCP .NET .
Depois, você pode reservar um tempo antes e depois da chamada para Session.GetFiles
e calcular a velocidade:
$remotePath = "/home/ftp/download/01_MBytes.txt"
$localPath = "C:\downloads_MBytes.txt"
Write-Host "Starting download"
$start = Get-Date
$session.GetFiles($remotePath, $localPath).Check()
$duration = (Get-Date) - $start
$size = (Get-Item $localPath).Length / 1024
$speed = $size / $duration.TotalSeconds
Write-Host "Downloaded file $remotePath to $localPath"
Write-Host ("Size {0:N0} KB, Time {1:hh\:mm\:ss}" -f $size, $duration)
Write-Host ("Speed {0:N0} KB/s" -f $speed)
Um script completo está abaixo. Ele se baseia no exemplo oficial do PowerShell para o assembly WinSCP.NET .
try
{
# Load WinSCP .NET assembly
Add-Type -Path "WinSCPnet.dll"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "example.com"
$sessionOptions.UserName = "user"
$sessionOptions.Password = "mypassword"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:..."
$session = New-Object WinSCP.Session
try
{
# Connect
$session.Open($sessionOptions)
$remotePath = "/home/ftp/download/01_MBytes.txt"
$localPath = "C:\downloads_MBytes.txt"
Write-Host "Starting download"
$start = Get-Date
$session.GetFiles($remotePath, $localPath).Check()
$duration = (Get-Date) - $start
$size = (Get-Item $localPath).Length / 1024
$speed = $size / $duration.TotalSeconds
Write-Host "Downloaded file $remotePath to $localPath"
Write-Host ("Size {0:N0} KB, Time {1:hh\:mm\:ss}" -f $size, $duration)
Write-Host ("Speed {0:N0} KB/s" -f $speed)
}
finally
{
# Disconnect, clean up
$session.Dispose()
}
exit 0
}
catch [Exception]
{
Write-Host $_.Exception
exit 1
}