Re: Progress bar
WinSCP .NET assembly does not present any progress bar (it has no GUI at all). So it has to be your run-time environment that shows the progress bar.
# SFTP does not have an append verb so it has to be get->append->put
$rem = "{0}{1}" -f $carrdir, $rcdf
if ($send -eq "R" -and $session.FileExists($rem)) {
if ($session.GetFiles($rem, $rcdtemp).IsSuccess) {
$session.RemoveFiles($rem) | Out-Null
Get-Content ($rcdtemp) |
Add-Content ("{0}\{1}" -f $temploc, $rcdf)
} else {
CleanUp-Exit(2)
}
}
# This creates a directory in $carrdir named like $temploc
$session.PutFiles($temploc, $carrdir).Check() | Out-Null
# Get list of files uploaded
$files = $session.ListDirectory($carrloc).Files | Where { -not $_.IsDirectory }
# Move the files up into $carrdir
ForEach ($fileinfo in $files) {
$session.MoveFile($carrloc + "/" + $fileinfo.Name, $carrdir)
}
if ($session.Opened) {
$session.RemoveFiles($carrloc) | Out-Null
$session.Dispose()
}
foreach ($fileInfo in $directory.Files)
foreach ($fileInfo in $Files)