Random File From Path
Grab a random file out of a folder
- text
This is the simplest node in the whole pack, and it does exactly what the name says: point it at a directory, get back the path of one random file inside it. No extension filtering, no metadata, no sorting logic - just "pick something." If you've got a folder of reference images, sample outputs, or candidate files and you want a different one selected on every run without wiring up a whole file-browsing setup, this is the one-node version of that.
How it works
Give it a directory path. On each run it lists what's in there and returns one file's path as a string, chosen by the seed input the same way the wildcards nodes do it - same seed, same pick, so a specific "random" result is reproducible if you need it to be. It doesn't care what kind of file it picks; it has no concept of images versus text versus anything else. It just returns a path.
That plainness is the whole value proposition. There's no dedicated "random image loader" you have to configure with filters - you point this at a folder and downstream nodes decide what to do with the path. The README pairs it with Load Image From URL from comfyui-art-venture for the image case, but really it's a general-purpose "roll the dice on a directory" utility - useful anywhere you want variety without hand-picking which file each run.
Inputs and output
directory- the folder to pick from. Local filesystem path, not a URL.seed- controls which file gets picked; same seed reproduces the same selection.
Output: a single text (STRING) - the selected file's path.
Installing it
ComfyUI Manager: search ComfyUI-GTSuya-Nodes, install, restart. Or by hand: cd ComfyUI/custom_nodes && git clone https://github.com/GTSuya-Studio/ComfyUI-Gtsuya-Nodes.git, then restart. No models, no dependencies - it's a directory listing wrapped in a node.
Where people get burned
Because there's no extension filter, a mixed-content directory hands back garbage some of the time - drop a .txt readme or a .json config into the same folder as your images and eventually this node will "randomly" select that instead of a picture, and whatever's downstream (an image loader expecting a real image path) will error out. Keep the target directory single-purpose: only the file type you actually want it picking from. Second, it returns an absolute filesystem path, not a URL - if you're chaining it into something that specifically expects a http(s):// string rather than a local file loader, that mismatch is worth checking before you assume the wiring is broken. And obviously: it only sees what's already on disk where ComfyUI is running, so on a cloud executor the path needs to point somewhere inside that machine's filesystem, not your laptop's.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |