Nodes/ComfyUI-JNodes/Subdirectory Selector
ComfyUI Node

Subdirectory Selector

Build a folder path from a root and a subfolder

By JaredTherriault·Created 3 years ago·Updated about a month ago· 91
Subdirectory Selector
    • out_path
    root_directory
    new_directory

    If you've used JNodes' ImageDrawer at all, you've already met this idea in UI form: browse Output or Input, and there's a subdirectory picker below the search bar that lets you drill into a specific folder instead of dumping every image you've ever made into one wall. This node is the graph-side version of that concept - you give it a root directory and a subfolder, and it hands you back a combined path as a string, ready to feed into whatever node actually needs to read from or write to that location.

    What it does

    Two text fields go in, one path comes out: a root_directory (your base folder - think output, input, or a models/loras style path) and a new_directory (the subfolder underneath it), joined into a single out_path string. That's the whole job - it's a path-building utility, not a file browser itself. Where it earns its keep is upstream of nodes that consume a plain path string: something like JNodes_SelectRandomFileFromDirectory (returns a random image or video path from a directory), or JNodes' own save/output nodes, all of which take a directory as a string rather than exposing their own folder picker.

    Worth flagging: the README doesn't document this specific node by name, so the exact join behavior (whether it normalizes slashes, whether new_directory supports nested paths like characters/oc1) isn't spelled out anywhere public. Test the output with a Preview/print node on a real path before wiring it deep into a graph you depend on.

    Inputs and outputs

    • root_directory - single-line text, empty by default. The base path everything else builds from.
    • new_directory - multiline text, empty by default. The subfolder you want appended.
    • out_path (output) - a STRING, the combined path. Wire this into anything downstream that expects a folder path - file loaders, save-path nodes, or another JNodes utility that reads from a directory.

    Installing it

    Standard JNodes install, no separate dependency for this node:

    • ComfyUI Manager - search "JNodes", install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/JaredTherriault/ComfyUI-JNodes, run pip install -r requirements.txt, restart ComfyUI.

    Common issues

    Because this node just concatenates two strings into a path, the failures you'll hit are path failures, not node failures: a root_directory that doesn't exist on disk, a new_directory with a leading or trailing slash that produces a doubled or malformed separator, or a relative path that resolves differently than you expected depending on where ComfyUI was launched from. If a downstream node complains it "can't find" a directory, print out_path first and check it against the actual folder on disk before assuming the consuming node is broken.

    More generally, the same JNodes-wide caveat applies here as with every node in this pack: installing it changes ComfyUI's UI immediately (a docked image drawer, a status/progress indicator), and the README's Caveats section calls out real conflicts with pysssss.ImageFeed and a couple of other popular extensions. If your workflow's UI looks different after adding JNodes and you didn't expect that, it's the pack, not this node - head to ComfyUI Settings > JNodes > Extension Management to turn pieces off individually rather than uninstalling the whole thing.

    Categorysd

    Inputs (2)

    NameTypeDefaultDescription
    root_directorySTRING
    new_directorySTRING

    Outputs (1)

    NameTypeDescription
    out_pathSTRING