Re: Powershell Script to get a latest file with a Specific dynamic name
So just add your constraint. Something like:
(assuming you are using this script: https://winscp.net/eng/docs/script_download_most_recent_file#powershell)
$latest =
$directoryInfo.Files |
Where-Object { -Not $_.IsDirectory } |
Where-Object { $_.Name.Contains("1234") } |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
(assuming you are using this script: https://winscp.net/eng/docs/script_download_most_recent_file#powershell)