ComfyUI Node

Concatenate

Joining strings in ComfyUI — and the prefix trap that breaks file paths

By nova452·Created 2 months ago·Updated 20 days ago· 499
Concatenate
    • STRING
    delimiter
    string_1
    string_2
    string_3
    string_4
    string_5
    string_6
    string_7
    string_8
    string_9

    Concatenate is the node you reach for when a filename has to be assembled from pieces: a folder, a zero-padded number, an extension. It takes two strings, string_a and string_b, glues them together, and gives you back one STRING. The extra bit - the reason you'd pick it over ComfyUI's own Text Concatenate - is optional prefix and suffix fields that wrap the result.

    But read the order carefully, because this is where people get burned. The assembly is prefix + string_a + string_b + suffix. The prefix goes at the very start of the output, before string_a - the author's own description flags this with an all-caps note: "prefix uses the final string as reference, not string_b!" The intuitive assumption is that a prefix attaches to whatever comes after it, so if you're thinking "string_a is the directory, string_b is the filename, prefix is the path," you get a wrong path: prefix lands in front of the directory, not in front of the file. "/media" + "videos" + "clip.mp4" with prefix "/output" produces "/outputmedia/videos...", which is not a thing that exists on your disk. If you're building file paths, test the output once before you trust the wiring.

    The inputs are exactly what they look like: string_a and string_b (required, both STRING), plus prefix and suffix (optional, both STRING). The suffix is the least surprising of the bunch - it genuinely appends to the end, which is where suffixes belong. Output is a single STRING.

    Where this shines is batch naming. The canonical Arkl1te combo is: Count Files In Directory gives you how many clips already exist → Pad Zeroes turns that into 0042 → Concatenate assembles video_0042.mp4 → Save Video writes it with a name that sorts correctly next to the others. It also works for seeds, prompt fragments, or any string you'd otherwise hand-assemble with a clunky FString/format node.

    Honest take: there are a dozen string-join nodes out there, and ComfyUI core has one built in. This particular one earns its keep through that prefix/suffix convenience - and through being part of a tiny, zero-dependency pack, which means it won't drag in pip conflicts when a workflow needs it. Install via ComfyUI Manager by searching "Arkl1te's Toolkit", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cybernaut4/comfyui_arkl1te_toolkit
    

    Restart ComfyUI after cloning. No requirements.txt, no model downloads, no extra Python deps - the pack uses only ComfyUI's bundled comfy.comfy_types. If your output looks wrong, 90% of the time it's the prefix ordering above. The other 10% is feeding it non-strings, which will fail loudly rather than silently.

    CategoryRebalance-Pack/foundational

    Inputs (10)

    NameTypeDefaultDescription
    delimiterSTRINGInserted between non-empty sections.
    string_1STRING
    string_2STRING
    string_3STRING
    string_4STRING
    string_5STRING
    string_6STRING
    string_7STRING
    string_8STRING
    string_9STRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING