Re: Remote synchronize, delete removed files but not folders
Yes, this is indeed the correct solution.
See https://winscp.net/eng/docs/faq_script_non_recursive
See https://winscp.net/eng/docs/faq_script_non_recursive
$TransferOptions = New-Object WinSCP.TransferOptions
$TransferOptions.FileMask = "|*/"
# Synchronize files
for ($i=0; $i -lt $localePathArray.length; $i++) {
# Write-Host "$localePathArray[$i] $remotePathArray[$i]"
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote, $localePathArray[$i], $remotePathArray[$i], $True, $False, [WinSCP.SynchronizationCriteria]::Time, $TransferOptions)
}
# Synchronize files
for ($i=0; $i -lt $localePathArray.length; $i++) {
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote, $localePathArray[$i], $remotePathArray[$i], $True)
}