Glob Files (Yogurt Nodes)
Feed a whole folder of images into ComfyUI without typing paths by hand
- file_paths
There's a moment in every batch workflow where you realize you're about to wire the same image path into twelve nodes by hand. Glob Files is the "no thanks" button for that. Point it at a folder, give it a pattern, and it returns a LIST of matching file paths - which you can then index, slice, or feed into whatever loader the rest of your graph uses.
It's one of the I/O nodes in the YogurtNodes pack (yogurt7771/ComfyUI-YogurtNodes), and it's the piece that turns "I have 300 renders" into "I have a list I can loop over." Think of it as a poor man's batch scheduler: grab every *.png, sort them, walk them one at a time.
How it works
Under the hood it's Python's pathlib glob - the same pattern syntax you already know from the terminal. *.txt matches files in the root, **/*.py recurses into subfolders. You get a glob_mode toggle: glob walks left-to-right from the root, rglob walks right-to-left (useful when your pattern anchors on the filename and you want it matched against every directory level). The output is a single file_paths LIST.
The genuinely useful part is the filtering, which saves you from writing clever patterns at all:
files_only- drop directories, keep files.extension_list-"txt,py,json"keeps only those, case-insensitive. Setextension_is_imageand it treats the list as image extensions.prefix_list/suffix_list- comma-separated name filters likepre-1,pre-2.sort_files+sort_reverse- alphabetical order, ascending or descending. Leave sorting off and you get whatever order the filesystem gives you, which will not be the order you want.
Inputs that matter
root_directory- where to start. If you leave it empty you'll glob relative to ComfyUI's working directory, which is almost never what you meant.glob_pattern- multiline, one pattern per line; empty lines are ignored. The default*is fine for a flat folder.extension_list- the filter you'll reach for most."png,jpg,jpeg"and done.
The path-flavored toggles (as_posix, full_path, resolve_path, relative) mostly matter when you're on Windows or handing paths to other tools. as_posix swaps backslashes for /; resolve_path makes paths absolute and chases symlinks; relative returns paths relative to root_directory instead of absolute.
Output: file_paths - a LIST. Wire it to a ListIndex or a loop, or pair it with ListConcat / ListBinaryOps to merge a few globs into one batch.
Install
YogurtNodes is one clone away - via ComfyUI Manager (search "YogurtNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Then restart ComfyUI; the node lives under Yogurt Nodes / IO. No models, no API keys, nothing heavy - this one's pure Python.
Troubleshooting
The common complaints, in order of how often I see them:
- "It returned nothing." Check
root_directoryactually exists and the pattern matches - a*withfiles_onlyon a folder of only-directories gives you an empty list, by design. And rememberglob_patternis multiline: a stray empty line is ignored, but a pattern with a typo just matches nothing. - Recursion. If you want files in subfolders you need
**in the pattern (**/*.png) orrglobmode. Plain*.pngonly looks in the root. - Windows path confusion. Backslash-heavy absolute paths are a classic gotcha when you hand the output to other nodes. Flip
as_posixon if a downstream tool chokes. - Batch order isn't "natural". With
sort_filesoff, filenames can come back in filesystem order, which for numbered files means1.png, 10.png, 2.png. If order matters, turn onsort_files- or sort numerically downstream with a list sort node.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| root_directory | STRING | Root directory path, from which to start searching for files. | |
| glob_pattern | STRING | * | One glob pattern per line, e.g. '*.txt' or '**/*.py'. Empty lines are ignored. |
| sort_files | BOOLEAN | false | Sort the file paths in alphabetical order. |
| sort_reverse | BOOLEAN | false | Sort in descending order. |
| glob_mode | COMBO | glob | glob from left to right, rglob from right to left |
| files_only | BOOLEAN | false | Return only files, exclude directories. |
| as_posix | BOOLEAN | false | Convert the path to a POSIX format. |
| full_path | BOOLEAN | false | Return an absolute version of this path by prepending the current working directory. No normalization or symlink resolution is performed. |
| resolve_path | BOOLEAN | false | Make the path absolute, resolving all symlinks on the way and also normalizing it. |
| prefix_list | STRING | Prefix list, multiple prefixes separated by commas, e.g. 'pre-1,pre-2,pre-3' etc. Case insensitive. If empty, all files will be returned. | |
| suffix_list | STRING | Suffix list, multiple suffixes separated by commas, e.g. 'txt,py,json' etc. Case insensitive. If empty, all files will be returned. | |
| extension_list | STRING | Extension list, multiple extensions separated by commas, e.g. 'txt,py,json' etc. Case insensitive. If empty, all files will be returned. | |
| extension_is_image | BOOLEAN | false | If true, the extension list will be treated as image extensions. |
| relative | BOOLEAN | false | Return paths relative to the root directory. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| file_paths | LIST | — |