Re: Powershell Script to SFTP New files
See my answer to your duplicate question on superuser.com:
https://superuser.com/q/806633/213663
The script your took from WinSCP example for
To synchronize directories, use
https://superuser.com/q/806633/213663
The script your took from WinSCP example for
Session.GetFiles
was designed for a single file only. You have tried to bend it to synchronize directories instead. That cannot work.
To synchronize directories, use
Session.SynchronizeDirectories
:
# Synchronize files
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Local, $localPath $remotePath)
# Throw on any error
$synchronizationResult.Check()