When reporting transfer progress, access overall & current file size?
Session.FileTransferProgress
's event offers FileProgress
and OverallProgress
, but is there a way to also retrieve FileSize
and OverallSize
?
Getting both sizes via the event would be especially useful when using the convenience functions
{Get,Put}FilesToDirectory
that don't require one's code to individually reference files to be transferred.
My goal is to have both a graphical (overall) progress bar and a
"[ $total_transferred_size / $total_overall_size ] $current_filename ]"
status line underneath. The former is trivial, but the latter is a mess.
For PowerShell, I've tried looping through the individual files while using…
- for uploads:
(Get-Item $file.FullName).Length
- for downloads:
$files = $session.EnumerateRemoteFiles
$file.Length
$total_overall_size
and keeping track of $total_transferred_size
during the individual transfers, but that doesn't quite seem to work.
It's very cumbersome compared to just being able to use the convenience functions, especially given the required sizes already have to be known to WinSCP internally (otherwise, how could it calculate the progresses).