Show ProgressBar in PowerShell for SynchronizeDirectories download

Advertisement

HrHauptfeld
Joined:
Posts:
2
Location:
Somewhere

Show ProgressBar in PowerShell for SynchronizeDirectories download

Hello every1,

I'm trying to create a small powershell script to make my life a bit easier. I'm currently using the following script to sync a local directory with my remote folder and delete the remote files after the DL which works great: https://winscp.net/eng/docs/library_example_delete_after_successful_download

But now I'd like to implement an extra progress bar for the download, just to have a visual confirmation that the script is still running if there are a LOT files to DL.

All the examples I could find (involving FileTransferProgress) only produce text output which I'd like to avoid.

Is there any way to utilize Write-Progress for a nicer output of the download? The progress bar should advance for every file that's been downloaded successfully.
PS: It doesn't have to work with the Synchronize option. GetFiles would also work for me.

Thanks

Reply with quote

HrHauptfeld
Joined:
Posts:
2
Location:
Somewhere

yeah. thanks.
works like a charm :)

I just modified the funtion a little so that I have everything in just one progressbar.

function FileTransferProgress
{
   param ($e)
   
   Write-Progress `
               -Id 0 -Activity "Downloading" -CurrentOperation ("$($e.FileName) - {0:P0}" -f $e.FileProgress) -Status ("{0:P0} complete at $($e.CPS) bps" -f $e.OverallProgress) `
               -PercentComplete ($e.OverallProgress * 100)
}

Reply with quote

Advertisement

You can post new topics in this forum