JDCN_AnyFileSelector
Pick one file out of a list without re-typing a path
- out
JDCN_AnyFileSelector is the "pick one" node for file lists. Feed it a list of paths, tell it which index you want, and it hands back a single path. Where JDCN_AnyFileList gives you a whole folder as a list, this node narrows a list down to the one item you actually want to use this run.
How it works
The node takes a List of strings (it's list-input, so wire the PathList output from JDCN_AnyFileList or JDCN_AnyFileListRandom straight into it), an Index integer, and a Change dropdown with fixed, increment, and decrement options. The single output, out, is one string from the list.
Index is 1-based, so Index = 1 grabs the first element. The mechanism underneath is literally List[Index - 1] - nothing fancier. That's also why the Change dropdown is worth a little honesty: in the actual code, it's a UI hint, not logic. The node always returns the element at Index - 1; fixed / increment / decrement is just a label describing how you plan to move the index between runs. If you want automatic incrementing, you drive Index from a counter yourself.
When you'd use it
- You want to sample one image from a folder of references per run.
- You're chaining:
AnyFileListβAnyFileSelectorβAnyCheckpointLoader, and changing the index swaps which checkpoint you load without opening the loader. - You want a manual "next / previous" feel in an animation or gallery workflow - bump the index, queue again, get the next file.
Because it's a pure string passthrough, the selected path plugs into anything that accepts a file path: loaders, movers, image loaders, text savers.
Installing it
Part of ComfyUI-JDCN:
- ComfyUI Manager β Install Custom Node β search JDCN β install ComfyUI-JDCN β restart.
- Or clone manually:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt
Restart ComfyUI; the node lives under π΅ JDCN π΅. The pack's only dependency is piexif, no models to grab.
Common issues
The two failure modes both print Error in List Variable and return nothing: an empty list, or an index out of range (below 1 or past the end of the list). Both are easy to hit if you point it at an empty folder or forget that the index is 1-based. Also remember it wants a list input - if you hand it a single string, you'll get confusion rather than a selection.
If your selected file doesn't do what you expected, double-check you're reading the list order correctly. The list nodes in this pack return files in OS order, which isn't necessarily alphabetical - see the AnyFileList article for that quirk.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| List | STRING | β | |
| Index | INT | 11β9999 | β |
| Change | COMBO | 3 options: fixed, increment, decrement |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| out | STRING | β |