We are running a script to relocate a file from our Integrated File Server (IBMi) to a [file server] . The PUT in the script intermittently produces errors. The majority of times this script runs, the PUT correctly places the file in the desired directory. Occasionally, and with no rhyme or reason, the PUT causes a sub-directory (bearing the name of the PUT-target) to be created in the desired directory instead of putting the actual file there. And if we delete that sub-directory and run the script again, the file is created correctly.
We are using WinSCP Ver 5.15.1 (Build 10071) on Windows Server 2012 R2, and we have multiple other similar scripts that run correctly 100% of the time.
I've attached three files - the FTP-script, the log of a run that failed, and a log of a run that worked.
If you copy this following text and search each log, you'll find the point at which the run-logs diverge: File... F:\StateBank\PositivePay\RCN52477.TXT' [2020-01-01T02:54:17.197Z] 
Any help would be greatly appreciated.
Thanks muchly and best regards,