Description
Extract all files' names in a directory and stores them in an array. The 'Save value to variable' activity appears automatically when choosing the 'List directory files' activity. It automatically saves the value to a variable. However, the activity is not mandatory to use and can be removed from the workflow.
Below is an example of setting up and using the activity to read the names of files and folders in a directory.

Parameters
-
Set a value: enables you to directly write the desired folder path to extract files names from.
-
Save the previous step result: chooses the previous activity result as a path.
-
Calculate a value: enables you to use available properties and methods to form a path.
Contains an annotation to the activity. The input text will be displayed above the activity name.
Result
The list of files and folders is stored in the directory_files
variable by default. This variable represents an array of strings. For example, if in the specified folder there are folders "documents", "reports" and files "scan.png", "employees.xlsx", "agreement.docx" then the output array of string will be the following: ["agreement.docx", "documents", "employees.xlsx", "reports", "scan.png"]
.
Interaction with folders
This activity can interact not only with files, but also with folders. In order to specify the folder path, you need to copy it from the file explorer and paste it manually to the parameter “Path”. Keep in mind that the “Pick” button will not allow you to pick folders.
Usage Examples
This activity is useful when you need to perform similar actions with a huge amount of files. In this case you can get all files' names in a folder and then run a loop.