Load File Paths From Folder
Point it at a folder, get every file path back
- filepaths
- filenames
- count
If you've ever tried to batch-process a folder in ComfyUI, you know the pain. Directory loader nodes don't auto-increment, Queue Instant re-runs the same image forever, and the tutorials show features that don't exist anymore. This node is the boring part of the fix: give it a folder and an extension, and it hands you the list of matching files and how many there are. That's it. The loop machinery - internal or external - is somebody else's job, and LoadFilePathsFromFolder is happy to be the input.
It's the anchor node of the ComfyUI-FilePathsFromFolder pack, and honestly the pack's personality is right there in the name: it does nothing but file paths. No upscaling, no image ops, no models, no API keys. It's seven small nodes that turn a folder scan into something a loop can consume.
How it works
Under the hood it's about as deep as a puddle: os.path.join(folder_path, extension), a glob.glob() call, a sort. The author's code builds one search pattern from your folder and extension, finds every match, sorts them alphabetically, then returns:
filepaths- the full paths, one per line, joined with newlinesfilenames- just the base names with the extension stripped, same ordercount- the number of matches, as a realINT
Two of those facts are the whole game. First, filepaths and filenames come out as one big newline-joined string, not a native list type - the pack's own GetPathByIndex node exists to split that string and pick items out of it by index. Second, count is what you feed a loop pack's "iterations" or "max" input, so the loop knows when to stop.
The two inputs you actually set
folder_path- the folder to scan. It's a plain string, so use an absolute path (C:\data\inputson Windows,/home/user/inputson Linux). It's widget-only; you can't convert it to a wired input here.extension- a glob pattern, default*.png. Anythingglobaccepts works, so*.png,*.mp4,*.txt,*_upscaled.pngare all fair game. Handy for pairing a folder of images with their.txtcaption files in the same loop.
One trap worth knowing: the glob isn't recursive. glob.glob() without recursive=True only matches the top level of the folder, so *.png will not dig into subfolders. If your inputs live in nested directories, point folder_path at the actual folder that holds the files.
How to install it
The pack has no requirements.txt and no model downloads - it's pure Python stdlib (os and glob), so install is a one-liner:
cd path/to/ComfyUI/custom_nodes
git clone https://github.com/RockyHong/ComfyUI-FilePathsFromFolder.git
Then restart ComfyUI. If you use ComfyUI Manager, search for "ComfyUI-FilePathsFromFolder" and hit install there instead. The pack is small and relatively fresh (it landed in early 2026), so if you don't see it in Manager's list yet, the git clone route always works. After restarting, search the node menu for "Load File Paths From Folder."
Common issues
The most common mistake is expecting filepaths to be a list you can feed straight into a batch-aware loader. It's a string - a newline-joined one. Route it through GetPathByIndex (driven by your loop's index) and you'll be fine. Second most common: nothing comes back because the extension doesn't match, or the path has a trailing slash that puts the pattern in the wrong place. glob is literal about that. And if your folder is empty, count is just 0 and you'll get empty strings - your loop should be wired to handle zero iterations gracefully, because this node won't complain.
For the classic "run this once per file" flow, pair this node with an external for/while loop pack (Impact Pack, rgthree, whatever you already use): count drives the iteration count, the loop index drives GetPathByIndex, and the picked filepath feeds your Load Image / Load Video node. Or skip all of that and use the pack's own File Paths For Loop Start, which does the same job natively.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| extension | STRING | *.png | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| filepaths | STRING | — |
| filenames | STRING | — |
| count | INT | — |