FTP - Download Newest or Oldest File on FTP Server
Download the newest or oldest file via FTP
This sample task will demonstrate how Automate can download the newest or oldest file via FTP. Automate will do the following:
1. Logon to a FTP server.
2. Execute the "Get long file list" command using Automate's FTP Advanced action and populate a dataset with the results.
3. Loop through the dataset FileList, which has a list of files and folders on the FTP server.
4. Populate the variable %varFile% with the first file found on the FTP server and %varFileDate% with the date of that file.
5. Each subsequent loop will compare %varFileDate% with the date of the next file on the server. If the file date is newer or older, based on the settings at the beginning of the task, then both %varFile% and %varFileDate% will be updated.
6. Download the file %varFile%.