Convert to Powershell - SynchronizeDirectories Almost there.
trying to convert a batch synchronize file to PowerShell and not sure how to convert the resumesupport switch.
I use a script file and it looks like this:
Here's what I have so far in my Powershell:
Again looking for help converting the resumesupport switch and to ensure I've got the rest of the PowerShell script correct.
Thanks,
Kevin
I use a script file and it looks like this:
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
Here's what I have so far in my Powershell:
# 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()
Thanks,
Kevin