Re: Delete all files older than two days, except the ones beginning with a specific string
It's not possible with WinSCP scripting.
But you do it with WinSCP .NET assembly from a PowerShell script.
https://winscp.net/eng/docs/library_powershell
Here is an example that does almost what you need:
https://stackoverflow.com/q/38616995/850848#38617996
You just need to add a file name test, like:
(untested)
But you do it with WinSCP .NET assembly from a PowerShell script.
https://winscp.net/eng/docs/library_powershell
Here is an example that does almost what you need:
https://stackoverflow.com/q/38616995/850848#38617996
You just need to add a file name test, like:
$oldFiles =
$directoryInfo.Files |
Where-Object { -Not $_.IsDirectory } |
Where-Object { $_.LastWriteTime -lt $limit } |
Where-Object { $_.Name -notlike "database*" }
(untested)