So you want to write a script for this?
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
You can use a search function in Windows File Explorer to create a list of those files. And then drag&drop those files to WinSCP remote panel.