How to modify script to only download latest file?

Advertisement

jmcelvoy
Joined:
Posts:
1
Location:
Missouri

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?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum