ComfyUI Node

Path Join

Glue folder paths together without fighting your OS

By ethanfel·Created 7 months ago·Updated 2 months ago· 2
Path Join
    • path
    segment_1
    segment_2
    segment_3
    segment_4
    segment_5
    segment_6

    Path Join does one boring thing and does it correctly: it joins up to six path segments into one clean path, the way os.path.join does - because that's literally what it calls under the hood. If you've ever built output_path + "/" + filename by hand in a concat node and watched it explode on a trailing slash, you know why this exists.

    The inputs and output

    • segment_1 (required) - the start of the path, usually a directory.
    • segment_2segment_6 (optional) - more pieces, left unwired when unused.
    • Output: path (STRING).

    Everything passes through os.path.join, then os.path.normpath, so it handles the messy cases for you: segments with or without trailing slashes join cleanly, duplicate separators collapse, and .. segments get resolved. On Windows it produces backslash paths and on Linux/macOS forward slashes - same node, right answer for your OS, no hand-editing.

    The practical wins over a raw concat node: you can feed segments from anywhere (JSON loader keys, string primitives, folder pickers), it's read-at-a-glance when you have three or four components, and you never end up with output//frame_001.png double separators. It's the natural companion to the pack's String Format node - join the directory with Path Join, format the filename, then feed the whole thing to an absolute-path saver like FastAbsoluteSaver.

    One thing it does not do

    os.path.normpath only normalizes the string; it doesn't check the folder exists and doesn't create it. Path Join is pure string plumbing - if the target directory doesn't exist yet, you still need whatever saves to the path to create it (FastAbsoluteSaver does, for what it's worth). And it won't tell you if a segment points at a file that isn't there; that's a loader's job, not a path builder's.

    Install

    Part of ComfyUI-JSON-Dynamic - ComfyUI Manager → search JSON Dynamic Loader, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ethanfel/ComfyUI-JSON-Dynamic.git
    # restart ComfyUI
    

    No dependencies, no models.

    Verdict

    It's the definition of a small utility node: if you build paths once a month, skip it. If your workflow assembles output paths, dataset folders, or per-shot directories programmatically, this is the node that quietly prevents a whole class of "why is my file in the wrong folder" bugs. Boring, and meant to be.

    CategoryJSON Dynamic/string

    Inputs (6)

    NameTypeDefaultDescription
    segment_1STRING
    segment_2optSTRING
    segment_3optSTRING
    segment_4optSTRING
    segment_5optSTRING
    segment_6optSTRING

    Outputs (1)

    NameTypeDescription
    pathSTRING