I am trying to download all files matching simple YYYYMMDD mask except *.cntl.
My YYYYMMDD mask is stored in a global [string] variable: $Global:dt
Session options (host, username, password, hostkey fprint) are stored in another global variable: $Global:sessionOptions
This is what I tried so far:
-----------------------------------------------------------------
Add-Type -Path "C:\Program Files\WinSCP Automation\WinSCPnet.dll"
$session = New-Object WinSCP.Session
$session.Open($Global:sessionOptions)
$remotePath = "/outgoing/"
$localPath = "C:\incoming\"
$topt = New-Object WinSCP.TransferOptions
$topt.FileMask = "*$Global:dt*|*cntl"
$session.GetFiles($remotePath, $localPath, $topt) | Out-Null
-----------------------------------------------------------------
The above always downloads all files matching the YYYYMMDD mask but ignoring the exclusion part of the mask (i.e. |*cntl). In other words, *YYYYMMDD*.cntl files are always downloaded. I tried to replace |*cntl with |*.cntl - no luck.
Automation library version 5.15.0
Powershell 5.1.14409.1018
Win 7 x64 Enterprise
Any hints what I am doing wrong?