Docs
RunMacro Documentation
Learn RunMacro from basics to advanced.
Everything you need to start and master RunMacro — from basic commands to advanced automation workflows.

List files and folders in RunMacro
List Files and Folders scans a folder by pattern, filters by kind, optionally recurses, then saves the list and count to variables.
Prerequisites
- The folder exists and is readable.
Supported modes
- Desktop Mode — Operates on the local file system.
- Browser Mode
What it does
The List Files and Folders command scans a folder and returns items matching a pattern (e.g. *.png). You can filter by kind (file/folder), recurse into subfolders, and choose the result format and how paths are shown. The list and its count are saved to variables.
When to use it
- Get a file list to loop over and process each one.
- Count files matching a pattern.
- Walk a folder tree to collect data.
When not to use it
- You only need to check if one file exists — use IF File Exists.
Configuration steps
- Add a File › List Files and Folders command.
- Enter the folder and a pattern (default
*= everything). - Choose the kind (file/folder/any) and whether to recurse.
- Choose the result format (one per line or JSON) and return mode (full path / name only / relative path).
- (Optional) Rename the list and count variables. Save.
Every option explained
Expected result
The list variable holds the matching items (sorted); the count variable holds the total.
Real example
Example: loop over every PNG
- List: images folder, pattern
*.png, kind = file, return = full path. - Feed
{directory_entries}into a Loop to process each image.
Limitations and failure cases
- Very large listings can use memory when stored in a single variable.
Tips & common mistakes
Use the one-per-line format for easy looping; use JSON when another step needs to read an array.
Verification details
commands/filesystem.py
RunMacro