LoadLocalFilePath
List every file in a folder before you loop over it
- paths
- count
- relative_path
- base_dir
None of this pack's file nodes loop over a directory by themselves - you build that loop yourself out of a list and a for-each. LoadLocalFilePath is the node that hands you the list to loop over: point it at a folder and it walks that folder (optionally several levels deep) and gives you back every matching file's path, ready to feed into ReadTextFromLocalFile, LoadMaskFromLocalPath, or this pack's own ForEachOpen.
How it works
directory- leave it blank and the node walks ComfyUI's owninputdirectory instead of an arbitrary path; that's stated directly in the field's own tooltip.max_depth(default 1, range 1–64) - how many directory levels deep to search. 1 means just the folder you named, no subfolders.file_type- a shortcut dropdown (image/video/text) that filters by the usual extensions for that category.file_suffix- a manual override, pipe-separated (e.g..png|.jpg). The node's own tooltip is explicit that setting this makesfile_typestop having any effect - they don't combine,file_suffixwins outright.
The inputs and outputs that matter
Four outputs, each documented with its own tooltip in the node itself:
paths- the list of matching file paths; an empty list, not an error, if nothing matched.count- how many files that is, handy as a sanity check or as a value to hand straight back in an API response.relative_path- the same list of files, but relative to the base directory instead of absolute.base_dir- the root directory that actually got searched, useful when you leftdirectoryblank and want to confirm what it resolved to.
How to install it
Via ComfyUI Manager: search comfyui-easyapi-nodes, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
cd comfyui-easyapi-nodes
pip install -r requirements.txt
Restart ComfyUI; git pull later to upgrade. No models, no heavy dependencies.
Common issues & troubleshooting
The file_suffix-beats-file_type behavior is the one that actually catches people. Set file_type to image, then also type .txt into file_suffix expecting them to combine as an AND filter - you'll get text files back, not an empty list, because file_suffix silently overrides file_type rather than adding to it. Clear file_suffix entirely if you want the file_type dropdown to do the filtering.
This node only builds the list - it doesn't process anything. paths on its own doesn't do a thing to your files; wire it into ListUnWrapper or ForEachOpen to actually iterate over each entry.
Depth is capped at 64. Fine for basically any real folder structure, but worth knowing it's a hard schema limit if you're ever pointing this at something unusually deep.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | 若为空,遍历input目录 | |
| max_depth | INT | 11–64 | 查找最大目录层级 |
| file_type | COMBO | image | file_suffix值不为空时,此配置失效 |
| file_suffix | STRING | 指定过滤文件后缀,多个以|分割,如.png|.jpg |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| paths | LIST | 文件路径列表,若过滤不到文件返回空列表 |
| count | INT | 文件个数 |
| relative_path | LIST | 文件相对路径列表 |
| base_dir | STRING | 保存的根目录 |