FTP - Download Newest File on FTP Server

This sample task will demonstrate how AutoMate can download the newest 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 %varLatestFile% 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, then both %varLatestFile% and %varFileDate% will be updated.

6. Download the file %varLatestFile%.

This same task can be modified to specify newest or oldest file on the FTP server.

Download the task.