Extract all files' names in a directory and stores them in an array. The 'Save value to variable' block appears automatically when choosing the 'List directory files' function. It automatically saves the value to a variable. However, the block is not mandatory to use and can be removed from the workflow.
Set a value: enables you to directly write the desired folder path to exctract files names from.
Save the previous step result: chooses the previous function result as a path.
Calculate a value: enables you to use available properties and methods to form a path.
Contains an annotation to the block. The input text will be displayed inside the block above the function name.
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"].
This function 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.