Skip to content

List Files

Type: list-files  ·  Package: Filesystem Activities v1.0.6  ·  Output: List

Returns a list of paths of the files (or folders) inside a directory. It is the basis of processes that work on many files: go through every Excel workbook in a folder, process each downloaded PDF, archive what arrived today. It supports patterns (*.xlsx), searching sub-folders and filtering by kind.

Lists the content of the path folder. It filters by pattern, optionally goes into sub-folders (recursive) and decides whether to include files, folders or both (include). It returns the paths as a list of texts, which you usually loop over with For Each.

  • Order: paths come sorted alphabetically. With include = all, all folders come first and then all files.
  • Full paths: each item is the given folder plus the name (and sub-folders, when recursive = true), ready to pass to another activity.
  • Snapshot: the list reflects the folder when the activity runs; files arriving later are not included.
  • No side effects: it only reads the folder.
ParameterTypeDefaultDescription
pathstring—Folder to list. E.g. C:\downloads.
ParameterTypeDefaultDescription
patternstring"*"Filter by name with wildcards: * (any sequence) and ? (one character). E.g. *.xlsx, invoice_*.pdf. A single pattern; ** and lists such as *.pdf;*.xml are not supported.
recursiveboolfalseInclude the content of every sub-folder.
includestring"files"What to include: files, directories or all (both).

Returns a List of string with the matching paths. If nothing matches, it returns an empty list (it does not fail): check it with count(files) == 0.

MessageCause and fix
Directory not found.path does not exist or is not a folder. Create it first with Create Directory or check the path.
Access to the path '…' is denied.No permission on the folder or (with recursive = true) on one of its sub-folders: in that case the whole search fails.
'path' is required.The path expression evaluated to null.

Process every Excel workbook in a folder and its sub-folders:

List Files path = "C:/data" pattern = "*.xlsx" recursive = true → output: files
Log message = "Found " + count(files) + " files"
For Each items = files itemVariable = path
└─ activities:
Read Excel Sheet path = path → output: table
... process ...