π List Files
Turn a folder into a list your graph can actually iterate
- Files
ComfyUI's batch handling is great at "generate eight images" and terrible at "process the four hundred PNGs already sitting in this folder". There's no core node that reads a directory and gives you the contents. List Files is the missing first step of that pipeline: hand it a path, get back a newline-separated list of matching files that you can then split, iterate, or feed to something that reads one at a time.
How it works
Non-recursive mode is os.scandir plus fnmatch against the filename. Recursive mode walks the tree with os.walk, tracking how deep it is relative to the directory you gave it and pruning descent once it hits Max Depth.
Max Depth is the field with a confusing-looking default. -1 means unlimited, as the tooltip says. 0 means top level only - no subdirectories at all. 1 lets it go one folder down. The prune happens when depth >= max_depth, which is why zero is "just this folder" rather than "nothing". And when Recursive is off, Max Depth is ignored entirely - a detail that costs people a debugging session because changing it appears to do nothing.
Filtering is shell-style glob, not regex: *.png, *.jpg, *prompt*.txt. One asterisk, one pattern, that's the syntax - and no brace expansion, so the *.{png,jpg} trick you'd use in bash does nothing here. Run the node twice or widen to *.
The inputs and outputs that matter
Four inputs, and you'll set three of them: Directory (an absolute path - the tooltip is explicit about it, and relative paths resolve against ComfyUI's working directory, which is not where you think), Recursive, Max Depth, and Filter (default *, matches everything including files with no extension).
One output: Files, a single STRING with every match joined by newlines. That's the pack's convention for lists - no array type, just lines. The pack's Array From Text node will split it back into indexed items, or you can feed it to a Text Replace / Text Match if you're doing something simpler.
Two behaviours to design around. Results are unsorted - os.scandir returns directory order, which is whatever the filesystem hands over, and os.walk follows the same. If order matters for your filenames, sort downstream rather than trusting it. And a missing directory returns an empty string, not an error - if directory and os.path.exists(directory) is the only guard. A typo'd path gives you a silently empty output and a downstream node that does nothing, which is the least helpful failure mode in the pack.
How to install it
Ships in Avaray/honda-nodes - ComfyUI Manager β Node Pack β search Honda Nodes β Install β restart. Manual route:
cd ComfyUI/custom_nodes
git clone --depth 1 https://github.com/Avaray/honda-nodes.git
cd honda-nodes
python install.py
Nothing in install.py is strictly needed for this node (it's stdlib only), but the same script fetches the jq and ime binaries the rest of the pack uses, so let it run. No pip packages, no model files.
Common issues
Empty output. Check the path exists and is absolute. On Windows, remember a path typed with forward slashes works, but a UNC path (\\server\share) is a different beast - Path Normalize it first if you're not sure what you actually have. Also check the filter: *.png won't match .PNG on a case-sensitive filesystem, and fnmatch is case-sensitive on Linux.
It printed nothing and everything downstream ran on nothing. That's the silent-empty-string behaviour above. Put a Text Preview on the Files output the first time you wire a new directory in; it costs one node and saves you ten minutes of "why did my batch produce zero images".
It's slow on a huge tree. Recursive with Max Depth -1 on a folder with a hundred thousand files walks all of them and shoves every match into one string. Narrow the filter, or set Max Depth to something finite.
Order jumps around between runs. Filesystem order isn't stable. Sort explicitly if you care.
One caveat that applies to the whole File System group: these nodes take absolute paths and will happily read or move anything the ComfyUI process can reach. There's no sandbox and no allowlist - reasonable for a local install you control, not something to expose on a shared instance.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | Absolute path to the directory. | |
| recursive | BOOLEAN | false | β |
| max_depth | INT | -1 | Maximum depth for recursive search. -1 for infinite. |
| file_filter | STRING | * | Glob pattern to filter files (e.g., *.png). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Files | STRING | β |