Nodes/Path Generator/Path Generator
ComfyUI Node

Path Generator

Your output folder is a flat graveyard — Path Generator makes it a pipeline

By alexmunteanu·Created 3 months ago·Updated 3 months ago· 0
Path Generator
    • path
    • folder_path
    • filename
    output_folder
    config[{"name": "project", "type": "folder", "value": ""}, {"name": "shot", "type": "folder", "value": ""}, {"name": "prefix", "type": "prefix", "value": ""}, {"name": "suffix", "type": "suffix", "value": ""}]
    delimiter_
    sequencefalse
    frame_paddingfalse

    Every ComfyUI user hits the same wall: you run a shot, look in output/, and it's ComfyUI_00047_.png or a flat wall of 400 near-identical PNGs. SaveImage's filename_prefix helps, but it's one static string - fine for solo dabbling, useless the moment your output needs structure. Path Generator is a single node that builds the whole destination path for you: folder levels, filename parts, sequence subfolders, frame padding - and it can drive any of those parts from upstream nodes at run time.

    It's from alexmunteanu's comfyui-path-generator pack, and it's a genuinely small thing: one node, pure Python plus a frontend, zero pip dependencies. You don't need it for a one-off render. You want it when your naming scheme is a scheme - project/shot/comp_v001, VFX-style folders, per-shot subfolders, image sequences that need .%04d padding. The kind of thing that keeps a real pipeline greppable instead of a pile of _00001_ files.

    How it works

    The heart of the node is a segment editor that renders right on the node. Each segment has a type - Folder, Prefix, or Suffix - plus a name and a value. Folder segments become directory levels, prefixes and suffixes build up the filename, and everything gets joined by a delimiter (default _). You can reorder segments by dragging, rename them, delete them, and chain folder segments together so two values collapse into one directory level (MyShow_sh010 instead of nested folders).

    The clever bit: every segment's name becomes an input slot on the node. Wire a string into it and that segment's value comes from upstream, overriding what you typed. That's how you drive the filename from a frame counter, a model name, or a metadata string while keeping the rest of the path fixed - the live preview on the node updates as connected values change.

    Under the hood the segments live in a JSON config string stored on the node, the UI manages it, and the backend builds the path in a straightforward pass: folder values become the hierarchy, the filename is prefixes + folder values + suffixes joined by the delimiter, then sequence wraps the filename as its own subfolder and frame_padding appends .%04d. One thing worth knowing: this pack is written against ComfyUI's newer V3 backend node API - io.ComfyNode, define_schema, a comfy_entrypoint - not the classic NODE_CLASS_MAPPINGS style. That's not a bug, it's the modern way, and it's why the README warns you need a ComfyUI from 2025+.

    Inputs and outputs

    • output_folder - base folder, relative to ComfyUI's output/ directory. Leave it empty for the default. There's a Browse button backed by a small directory-browser route, though it's mainly handy on Windows where it lists drive letters.
    • delimiter - separator between filename parts, default _. Slashes are stripped so it can't sneak in a path level.
    • sequence - wraps the filename in its own subfolder (.../shot becomes .../shot/shot), the classic per-shot layout.
    • frame_padding - appends .%04d to the filename for image sequences. comp_MyShow_sh010_v001.%04d - that's the pattern video and comp tools actually expect.
    • config - the segment list, managed by the UI. You'll almost never touch it by hand.

    Outputs are three strings: path (folder + filename), folder_path, and filename. Wire whichever one your downstream saver wants - a custom save node, a video tool, anything that takes a path string.

    Install

    Easiest route: ComfyUI Manager → search "Path Generator" → Install, then restart. Or clone it manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/alexmunteanu/comfyui-path-generator.git comfyui_path_generator
    

    Then restart ComfyUI and double-click the canvas to add "Path Generator". That's the whole install - there's nothing to pip install, no model files, no API key.

    Where people get burned

    • "Node not found" is almost always a ComfyUI version issue: this is a V3 API node, so you need a ComfyUI from 2025 on. Older installs just won't register it.
    • Manual clone folder name matters. The README insists the folder be named comfyui_path_generator - clone it as anything else and import breaks.
    • Slash sanitization is intentional, not a bug. Slashes inside a segment value are stripped, so a segment can't inject extra path levels. Want more depth? Add another Folder segment.
    • A connected input that's empty contributes nothing - no placeholder, no None in the middle of your path. If a part looks missing, check the upstream node is actually outputting a non-empty string.
    • output_folder is relative to ComfyUI's output directory, not an absolute path (unless you type a drive letter). Leave it empty to get the default.

    It's a niche utility and it knows it - no community buzz, no drama, just a clean answer to a real organizational problem. If your outputs are still a graveyard of _00001_ files and you're tired of it, this is a five-minute fix.

    CategoryUtils/Path

    Inputs (5)

    NameTypeDefaultDescription
    output_folderSTRINGBase output folder (relative to ComfyUI output directory). Leave empty for default.
    configSTRING[{"name": "project", "type": "folder", "value": ""}, {"name": "shot", "type": "folder", "value": ""}, {"name": "prefix", "type": "prefix", "value": ""}, {"name": "suffix", "type": "suffix", "value": ""}]Segment configuration (managed by the UI).
    delimiterSTRING_Separator between filename parts.
    sequenceBOOLEANfalseCreate a subfolder with the filename: path/filename/filename
    frame_paddingBOOLEANfalseAppend .%04d frame padding to the filename.

    Outputs (3)

    NameTypeDescription
    pathSTRINGFull generated path (folder + filename).
    folder_pathSTRINGFolder portion of the path.
    filenameSTRINGFilename portion of the path.