Awesome- thanks for the point in the right direction
- shcsbaker
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::On
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote,"U:\", "/folderA/", $True, $False, [WinSCP.SynchronizationCriteria]::Time, $transferOptions)
$synchronizationResult.Check()
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote,"T:\", "/folderB/", $True, $False, [WinSCP.SynchronizationCriteria]::Time, $transferOptions)
$synchronizationResult.Check()
open sftp://username:password@myftp.com / -hostkey="host key"
synchronize remote -criteria=size -resumesupport=on -delete U:\ /folderA
synchronize remote -criteria=size -resumesupport=on -delete T:\ /folderB
close
exit
# Load WinSCP .NET assembly
Add-Type -Path "WinSCPnet.dll"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::sftp
$sessionOptions.HostName = "myftp.com"
$sessionOptions.UserName = "username"
$sessionOptions.Password = "password"
$sessionOptions.SshHostKeyFingerprint = "ssh info"
$session = New-Object WinSCP.Session
# Connect
$session.Open($sessionOptions)
# Synchronize Files
$session.[WinSCP.TransferResumeSupportState]::On
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote,"U:\", "/folderA/", $True)
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote,"T:\", "/folderB/", $True)
# Disconnect, clean up
$session.Dispose()