Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


How to modify script to only download latest file?

I'm trying to write a script via WinSCP that will connect to a FTP site and download a file from last night. The problem I'm running in to is the FTP source keeps 2 months of files and the only difference in the naming is the date. File name example: BankName_CityState_201908051000.XXX For this example, the date is 2019, Aug 5th, and file creation was at 10:00pm. This file is created every night at 10:00pm and I need a script that will download it from the FTP source to a server that will then process the file. Right now the script I have uses wildcard * for the date and the script grabs every file in the FTP source. The FTP source can't be modified so I need my script to only grab the latest file that meets the filename criteria. Is this possible?