I would like to change this PowerShell WinSCP script which is connecting to an SFTP Server, to only download .csv
files.
What part of the following portion of the script would I need to change?
# Connect
$session.Open($sessionOptions)
# Synchronize files to local directory, collect results
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $False)
Specify a filemask using TranferOptions.FileMask
to restrict the synchronization to specific extensions.
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "*.csv"
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $False, $False,
[WinSCP.SynchronizationCriteria]::Time, $transferOptions)