Re: Help with scripting a file from computer to server daily
As implied by my previous answer, you cannot implement this (selecting N latest files) using a simple scripting. Scripting can select one latest file only.
-latest
For a such a complex task, you would have to use WinSCP .NET assembly, from e.g. a PowerShell script.
Start with:
https://winscp.net/eng/docs/script_upload_most_recent_file#library
But modify it to select N files:Select-Object -First N
And then loop over the found files, like this example does:
https://stackoverflow.com/q/29787005/850848
Though you will want to upload them and you will want to change their target file name.
Select-Object -First N