DocsFileList Files and Folders

List files and folders in RunMacro

Desktop ModeBrowser ModeRunMacro 3.5+

List Files and Folders scans a folder by pattern, filters by kind, optionally recurses, then saves the list and count to variables.

Dialog & quick setup

RunMacro List Files and Folders command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the List Files and Folders command in RunMacro.
  1. Add a File › List Files and Folders command.
  2. Enter the folder and a pattern (default * = everything).
  3. Choose the kind (file/folder/any) and whether to recurse.
  4. Choose the result format (one per line or JSON) and return mode (full path / name only / relative path).
  5. (Optional) Rename the list and count variables. Save.

Options reference

Folder path

The folder to scan.

Pattern

A glob pattern like *, *.txt. Default matches everything.

Entry kind

file, folder, or any.

Recursive

If on, scans subfolders too.

Result format

newline (one item per line) or json (a JSON array).

Return mode

full_path, name (name only), or relative_path (relative to the scanned folder).

List variable / Count variable

Variable for the list (default directory_entries) and for the count (default directory_entry_count).

Modes & when to use

Desktop Mode

Operates on the local file system.

Browser Mode

Best for

  • Get a file list to loop over and process each one.
  • Count files matching a pattern.
  • Walk a folder tree to collect data.

Use an alternative when

  • You only need to check if one file exists — use IF File Exists.
Before you run
  • The folder exists and is readable.

Example workflow

Example: loop over every PNG

  1. List: images folder, pattern *.png, kind = file, return = full path.
  2. Feed {directory_entries} into a Loop to process each image.
Expected result: The list variable holds the matching items (sorted); the count variable holds the total.

Tips & limitations

Use the one-per-line format for easy looping; use JSON when another step needs to read an array.
  • Very large listings can use memory when stored in a single variable.

Applies to RunMacro 3.5+ · Desktop Mode & Browser Mode · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.