Skip to content

List files

Introduction

The list files task is responsible for filtering files at a specified destination. This task utilizes a non-recursive approach and excludes directories within the specified path. When no filename or pattern is specified, all files are included in the response object (ListFilesResponse).

However, if a filename or pattern is provided, the task attempts to match each file's name against the specified criteria, prioritizing filename matching over pattern matching. Only the files that match the specified criteria are included in the response as FileInfo objects within the list.

Configuration

  • Name - Display name of the task.
  • Connector - Previosly configured remote agent connector.
  • Path - Directory that will be observed.
  • Filename - The exact filename to check.
  • Pattern - Regular expression to match.
  • Log on complete - Prints the response in the business log.
  • Response - ListFilesResponse object that contains the list of FileInfo objects.

In most cases, you want to use either Pattern or Filename

For example, if we use a process variable res to catch the result from list files task, we will access the list of files and it's properties by using the following:

res.files
To access the total number of files at the given location:
res.files.size()
To access the particular element from the list, you should specify the ordinal file and the property:
res.files[0].filename
res.files[0].size
res.files[0].absolutePath

Example