Get Files
Get Files turns your input folder into one long string — and that's surprisingly useful
- STRING
Here's a ComfyUI problem nobody talks about until they hit it: how do you get the names of the files in a folder into the graph? The Load Image node only shows images you picked in advance. But if files keep appearing in your input directory - synced from a bucket, dropped by a script, sent by a friend - you want the graph to react to whatever is actually there. Get Files is the node that answers the question "what's in this directory right now?"
What it does
Give it a directory path and it lists every entry in that directory, sorts the names alphabetically, and joins them with newlines into a single STRING output. That's it - and the whole implementation is one line:
files = "\n".join(sorted(os.listdir(dir_path)))
The node is also an output node, so the list shows up in a UI panel as well. The idea is that downstream nodes pick this text apart - or you run the whole thing in a loop, with Get Files feeding a dynamic batch.
Inputs and outputs
Just one input: dir_path (STRING), which defaults to "input". The one output is STRING: the sorted, newline-separated directory listing.
Two things about that "input" default. First, it's a relative path, resolved against ComfyUI's working directory - which when you launch normally is the ComfyUI root, so "input" means ComfyUI/input. Fine for the common case. But if you ever start ComfyUI from a different folder (a script, a service, a Docker mount), that default silently points somewhere else. The node is explicit about it when it fails - VALIDATE_INPUTS paints the node red with No such directory ... if the path doesn't exist - but the lesson is: use an absolute path once you leave toy territory.
Second, the name oversells it. os.listdir returns everything in the directory: files and subdirectories, no extension filtering, no recursion. If your input folder contains a subfolder, it'll be in the list right next to your PNGs. For a utility node that's a real gotcha to design around - either keep the folder flat, or plan to filter the result downstream.
Why you'd actually use it
This is the flagship "dynamic" node of the pack. The project metadata describes these nodes as helpers for dynamic workflows, and this is the one that makes the graph self-aware: your input folder is the queue, and Get Files reads the queue. Combined with the pack's Format String (to build full paths) and Load Image By Path (to load whatever path you hand it), you can build a workflow that picks up whatever lands in input without you touching the graph. That's the pattern this whole pack exists for - which is more than most string-utility packs can say.
Installing it
The pack has no requirements.txt and no model downloads - only stdlib plus what ComfyUI already ships.
- ComfyUI Manager: search
comfyui_dynamic_util_nodes, install, restart. - Manual:
Restart ComfyUI.cd ComfyUI/custom_nodes git clone https://github.com/mullakhmetov/comfyui_dynamic_util_nodes
Where people get tripped up
- "No such directory" red error - the path really doesn't resolve. If it's relative, it's relative to ComfyUI's working directory, not to your home folder. Use the absolute path.
- "It listed a folder that isn't a file." Yes - see above.
os.listdirdoesn't discriminate. - "The order looks random." It's sorted alphabetically, which is more deterministic than
os.listdir's default OS-dependent order - a genuinely nice touch for batch workflows. - Empty directory returns an empty string. Nothing breaks, but downstream string-splitting will give you one empty entry.
It's not the node you think you need until you're writing a workflow that has to notice files, and then it's exactly the node you need.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| dir_path | STRING | input | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |