Reputation: 1353
I am new to WinSCP and PowerShell.
I am trying to look for files in a directory that has the pattern "ABC"+somenumbers+YYYYMMDD+somenumbers.zip
$dt = (Get-Date).ToString('yyyyMMdd')
$transferOptions.FileMask = ("ABC*>=" "+$dt+".zip")
I am not able to get any files downloaded to local directory. Is my file mask correct?
Thanks
MR
Upvotes: 1
Views: 809
Reputation: 25023
As the date is part of the filename, you don't need to use the ">" syntax in the filemask, which would be for the file modified time.
Powershell will expand variables inside double-quoted strings (Variable expansion in strings and here-strings), so you can use
$transferOptions.FileMask = "ABC*$dt*.zip"
Upvotes: 1