Fair enough - I missed the second $False off my script from when I previously had the Sync Criteria entry.
- Optimaximal
TransferOptions
is 7th argument of Session.SynchronizeDirectories
method:
# Synchronize files to local directory, collect results
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Local,
$localPath,
$remotePath,
$False,
$False,
[WinSCP.SynchronizationCriteria]::Time,
$transferOptions
)
$session = New-Object WinSCP.Session
# Connect to Remote Server, download files and remove
try
{
# Connect
$session.Open($sessionOptions)
# Set up transfer options
$transferOptions = New-Object WinSCP.TransferOptions -Property @{
TransferMode = [WinSCP.TransferMode]::Automatic
FileMask = "CF_Unsubscribes_*.txt"
}
# Synchronize files to local directory, collect results
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Local,
$localPath,
$remotePath,
$False,
$transferOptions
)
}
catch
{
exit 1
}
Finally
{
$session.Dispose()
}