Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Claudio1983

Re: PowerShell – Automation – FileTransferProgress – Volume transferred

Thanks very much :)
martin

Re: PowerShell – Automation – FileTransferProgress – Volume transferred

WinSCP .NET assembly currently does not expose number of bytes transferred. But as you are uploading, you can query the size of the source file and estimate the bytes uploaded based on the FileProgress:
(Get-Item $e.FileName).Length * $e.FileProgress
Claudio1983

PowerShell – Automation – FileTransferProgress – Volume transferred

Hi to all!
I need to expose the progress of file being transferred.
At the moment the script look like this:
function FileTransferProgress
{
    param($e)
    # New line for every new file
    if (($script:lastFileName -ne $Null) -and
        ($script:lastFileName -ne $e.FileName))
    { Write-Host }
    # Print transfer progress
    Write-Host ("`r{0} ({1:P0})" -f $e.FileName, $e.FileProgress)
    # Remember a name of the last file reported
    $script:lastFileName = $e.FileName
}
 
[...] #some stuff
$session.add_FileTransferProgress( { FileTransferProgress($_) } )
[...] #some stuff

This way, I get the percentage. What I need is the volume (if possible).
Thanks in advance for any help.
Full script attached if useful.
Have a nice day!

Claudio