Thanks Martin, missed that one when I was on the hunt for examples.
- TheJelly
try {
# Connect to the SFTP server
$session.Open($sessionOptions)
# Enabled transfer with resume support/to temporary filename for all files
$transferOptions = New-Object WinSCP.TransferOptions
# Synchronize local directory with remote directory (down and up)
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Remote, "$localpath", "$remotepath", $False
)
# Check for synchronization errors
$synchronizationResult.Check()
# Print synchronization results
foreach ($transfer in $synchronizationResult.Downloads) {
Write-Host "Download of $($transfer.FileName) succeeded"
}
foreach ($transfer in $synchronizationResult.Uploads) {
Write-Host "Upload of $($transfer.FileName) succeeded"
}
} finally {
# Disconnect and dispose session
$session.Dispose()
}
$transferOptions = New-Object WinSCP.TransferOptions
line, as you can see. But not sure exactly what the syntax should be for then enabling the ResumeTransferSupport transfer option