Retrieving an FTP Directory Listing

Applies To: AutoMate 6, AutoMate 5
Published: 11/14/05 , modified May 4, 2006

Introduction

Starting with AutoMate 6.0.5, the FTP Advanced action supports populating an AutoMate dataset with a directory listing from any compatible FTP server. Using this dataset, a user can test for the presence of specific files and tailor their task to specific file state situations on the FTP server. Other reasons include:

  • Only downloading files under a certain size
  • Only downloading files older than a certain date
  • Downloading and deleting all of the files in a directory without using wildcards in order to avoid removing files that are added between steps

Usage

Use the FTP Logon action to logon to an FTP server. Next, use an FTP Advanced step with the "FTP Command" parameter set to "Get long file list." On the data tab, set the "Create a dataset with file listing information" parameter to the name of the dataset to hold the file listing. Once the step executes, the dataset will contain four columns:

  • FTPFileName
  • FTPFileSize
  • FTPFileDate
  • FTPFileType

The dataset also contains standard dataset elements, such as TotalRows (the total number of files in the directory listing, in this case).

Example

<!--- Valued AutoMate user: Remember to change the FTP Logon information! --->
<AMFTPLOGIN SERVER="ftp.server.com" USERNAME="username" PASSWORD="pass">
<AMFTPADVANCED FTPCOMMAND="long_list" FTPLONGLISTDATASET="fileList">
<AMLOOPDATASET DATASET="fileList">
<AMMESSAGEBOX>
Filename: %fileList.FTPFileName%
Filesize: %fileList.FTPFileSize%
Filedate: %fileList.FTPFileDate%
Filetype: %fileList.FTPFileType%
</AMMESSAGEBOX>
</AMLOOP>
<AMFTPLOGOFF>

More Information

Consult the AutoMate 6 Help File Index under "Datasets" for more information on using AutoMate Datasets.