Nodes/DJZ-Nodes/Project Folder Path Node
ComfyUI Node

Project Folder Path Node

One node to stop your output folder from becoming a landfill

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 80
Project Folder Path Node
    • STRING
    rootoutput
    project_nameMyProject
    subfolderimages
    separatorauto

    ProjectFolderPathNode is a tiny utility that builds a folder path string for you - root/project_name/subfolder - with the inputs sanitized so you can't accidentally produce a path with spaces, slashes, or illegal characters in it. It returns one STRING, which you feed into anything that takes a save path: a custom save-image node, a video encoder, a text saver. That's it. That's the whole node.

    Underrated, though. If you're running a lot of batches, the fastest way to make a mess is every save writing into one flat folder. This node gives you a project-scoped path that sorts itself, and because it's a pure string builder you can route it to every save node in a workflow and keep one project's outputs in one place. It's the kind of hygiene node you don't appreciate until you're hunting for a specific render among 3,000 files.

    How it works

    It takes three string inputs - root (default "output"), project_name (default "MyProject"), subfolder (default "images") - and joins them with a separator. The separator option is auto (uses your OS's separator), forward_slash, or backslash, so you can force a consistent style regardless of platform, which matters if you're moving workflows between Windows and Linux.

    The clever part is sanitization, applied before joining:

    • unsafe filename characters (< > : " | ? *) are stripped,
    • spaces become underscores,
    • leading/trailing dots and slashes are removed.

    So project_name "My Cool: Render" quietly becomes My_Cool_Render. No error, no surprise - just a path that will actually work as a folder name. The node even marks itself as always-changed, so a change to any input recomputes the path immediately instead of caching.

    The inputs that matter

    • root - the base directory, relative to wherever your save nodes interpret paths. "output" is the sensible default.
    • project_name - the per-project folder. This is the input you'll actually swap between jobs.
    • subfolder - the per-type folder, e.g. "images", "videos", "text".
    • separator - leave on auto unless you need cross-platform consistency.

    Output: one STRING - the joined, normalized path (e.g. output/MyProject/images). Wire it into any save node that accepts a directory string.

    Installing it

    Part of DJZ-Nodes. ComfyUI Manager → Install Custom Nodes → search DJZ-Nodes → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MushroomFleet/DJZ-Nodes
    cd DJZ-Nodes
    pip install -r requirements.txt
    

    Pure stdlib (os only) - no dependency of the pack's is touched by this node. If the pack is installed, it just works.

    Common issues

    A couple of things to keep straight. First, it only builds the path - it does not create the folder. Your save node has to do that (most do when they write). If your save node doesn't create directories, you'll get write errors even though the path string looks perfect. Second, sanitization is silent: if you type a project name with a colon or asterisk and then wonder why the folder has a different name than you typed, this node is why. And because it's just a string, whatever consumes it must interpret relative paths the same way - "output/MyProject/images" means nothing to a node that expects an absolute path. Check what your save node wants before wiring.

    Categoryfile_management

    Inputs (4)

    NameTypeDefaultDescription
    rootSTRINGoutput
    project_nameSTRINGMyProject
    subfolderSTRINGimages
    separatoroptCOMBOauto3 options: auto, forward_slash, backslash

    Outputs (1)

    NameTypeDescription
    STRINGSTRING