Issues with Synchronisation & FileMask
As part of a SQL Server SSIS package, I'm attempting to download files from an FTPS source using a combination of Powershell and the WinSCP .NET Assembly.
I've used it elsewhere just fine, but I'm having issues making the file mask work correctly with Synchronisation.
The files on the FTP are of a format AA_Unsubscribes_Timestamp.txt, where AA is a collection of letters that could be anything, defined earlier in the SSIS package.
I have the following on a try catch loop in the powershell script:
Unless I'm misreading it, this should only pull down the files beginning with, for example, CF. As it stands, it's pulling down every file, regardless of the mask.
Am I doing something extremely dense?
Edit - The WinSCP Log File attached.
I've used it elsewhere just fine, but I'm having issues making the file mask work correctly with Synchronisation.
The files on the FTP are of a format AA_Unsubscribes_Timestamp.txt, where AA is a collection of letters that could be anything, defined earlier in the SSIS package.
I have the following on a try catch loop in the powershell script:
$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() }
Unless I'm misreading it, this should only pull down the files beginning with, for example, CF. As it stands, it's pulling down every file, regardless of the mask.
Am I doing something extremely dense?
Edit - The WinSCP Log File attached.