ListFiles

ListFiles

What to use it for

Prerequisites for usage

Essential properties to set

Use ListFiles to obtain a list of files in a specific directory.

This Activity is always used in combination with other Activities (e.g. list the files, then perform an action on each file).

None.
  • Path
  • Search pattern
  • Result

Misc

PropertyWhat is itHow to use it
Path

 

The location of the folder of which you want to list the files.

Enter a path to a folder.

You can enter the following:

  • Absolute folder path.
  • Relative folder path (not recommended).
  • VisualBasic expression that results in a folder path.

Recommended: Enter an absolute path.

Search pattern

 

Use a search pattern to indicate which files and folders you would like to list.

Leave empty, or use the wildcards * or ? to match partial file names and/or partial file extensions.

 Read more

 

  • Asterisk stands for 'match one or more unknown characters':

    *

     

    • Example:

      abc*.txt

       

      Matches file names of any name length, starting with 'abc' that have a txt extension, including 'abcdefgh.txt'.

  • Question mark stands for 'match a single unknown character':

    ?

     

    • Example:

      abc?.txt

       

      Matches file names of four characters starting with 'abc' that have a .txt extension, e.g. 'abcz.txt', but not 'abcdyz.txt'.

You can enter the following:

  • Absolute folder path.
  • Relative folder path (not recommended).
  • VisualBasic expression that results in a folder path.

Result

 

Option to save the results to a variable, for use later in the Workflow.

Create a variable of type System.Collections.Generic.IEnumerable<String> to save the results to.

 Read more
Why do I need variables

You can use variables to create a more flexible and sustainable Workflow.

Variables are mostly used in advanced Activities such as the Diversity Activities. These Activities often have two parts:

  • One part is to identify where to get data that serves as input for the Activity.
  • One part is to identify where to store data that serves as output for the Activity.

For the Diversity Activities it is common to store the data resulting from the Activity into a variable. Once stored in the variable, you can re-use the stored value elsewhere in the Workflow, by referring to the variable.

To create a variable to store data
  1. Click on the Variables button, below the Workflow. a panel will appear, containing an editable table.
  2. In the table click on 'Create variable' to start creating a new variable.
  3. Provide a name for the variable, preferably a name that describes its contents. Use camel case.
  4. Indicate the type of variable (e.g. boolean, integer, string, etc.). You can find specific types using 'Browse for types...'.
  5. Moving to another row saves this data to a new entry.

You can now use the name of this variable into one of the fields of the current Activity, or in Activities that are next.

Display nameName of the ActivityLeave at default, or edit the name to reflect what type files will be listed.

File system Activities