FTP - Download Then Delete Files From FTP Server
Download files from an FTP server and delete the same files that were just downloaded
The following sample task will download files from an FTP server and delete the same files that were just downloaded. This task is ideal if the user does not know the file names that are being downloaded and/or that need to be deleted.
Automate sends a 'Long List' command to the FTP server and saves the information into a dataset named 'fileList' (specified in the 'Data' tab of the 'FTP Advanced' action). The 'FTP Download' action will proceed to download the files on the next step (step #3). Thereafter, the 'Loop Dataset' action loops through the rows of the dataset specified (step #4). With each successive loop the current row of the dataset is incremented. The loop normally ends when at the end of the dataset. Step #5 displays a message box with the dataset options. This is mainly an example of the dataset information that is provided when using the 'Long List' command and is not needed to accomplish the task. Step #6 deletes the file(s) specified from the FTP server. On the remote file, %fileList.FTPFileName% is entered which will provide each filename within the dataset.
Note: In order for the task to work properly, make sure to make appropriate changes to the 'FTP Logon' step. Also, if the files you want to download / delete are not located in your FTP site's home directory, a 'Change Folder' action may need to be created to specify the correct directory.