Nodes/Shima/Shima File Namer
ComfyUI Node

Shima File Namer

File names that don't collide, with every part where you want it

By KDB-USJP·Created 6 months ago·Updated 6 months ago· 2
Shima File Namer
    • full_path
    • folder_path
    • filename
    • collision_id
    • timestamp
    • user_notes
    base_folderoutput
    project_nameproject
    base_name
    collision_id_enabledtrue
    collision_id_modenew_each_run
    timestamp_enabledtrue
    timestamp_format%Y%m%d_%H%M%S
    prefix
    suffix
    output_type
    filename_orderPRE,PRJ,BN,ET,SUF,TS,CID
    separator_
    user_notes
    external_project
    external_folder
    external_collision_id
    allow_external_linkingfalse

    Default ComfyUI output names are ComfyUI_00001_, ComfyUI_00002_... - fine for a few runs, miserable when you're iterating on a project and hunting for "the good one from Tuesday." Shima.FileNamer is the organized answer: it builds file paths and names from composable parts - project, base name, timestamp, a random collision ID - and emits every piece as its own STRING output so a saver downstream uses exactly what you configured. Think of it as the naming half of a proper file pipeline, with the FileSaver being the other half.

    How it works: the node assembles a filename from ordered components. There's a base_folder (default output, relative to ComfyUI root or absolute) and a project_name (default project) that becomes both the subfolder and part of the name. base_name is your own word; prefix and suffix bookend it; output_type is a label like rgb, depth, or mask for multi-pass pipelines. Two dedup weapons keep files from colliding: timestamp_enabled with a Python strftime format (%Y%m%d_%H%M%S by default), and collision_id_enabled which appends a 6-character random ID, with collision_id_mode set to new_each_run for unique files or fixed to keep the same ID across runs (that one matters when several savers must produce matched sets).

    The input that makes this node feel designed rather than bolted together is filename_order, an enum of presets like PRE,PRJ,BN,ET,SUF,TS,CID - prefix, project, base, output type, suffix, timestamp, collision ID - in the order you choose. Want the timestamp up front so files sort chronologically? Pick the preset that does that. separator chooses the character between parts (_, -, ., space, or none).

    Outputs are all STRINGs and all useful:

    • full_path - folder + filename (no extension yet).
    • folder_path - just the folder.
    • filename - just the name.
    • collision_id and timestamp - the exact values used, so a second node (a log, a metadata writer, a matched saver) can reference them.
    • user_notes - your freeform notes, passed through for downstream savers to embed as metadata.

    It also has external_project, external_folder, and external_collision_id optional inputs, so a Shima.Commons controller or another node can override those parts - which is exactly how a project-wide setup stays consistent without editing every namer.

    A couple of notes. It only names - nothing is written to disk until a saver consumes the paths. And because the collision ID is random per run, expect every batch to produce new names; if you need stable names for A/B comparisons, set collision_id_mode to fixed. Everything else is configuration that just works.

    Install the pack via ComfyUI Manager (search "Shima") or

    cd ComfyUI/custom_nodes
    git clone https://github.com/KDB-USJP/shima_wf
    

    then restart. No models or downloads.

    CategoryShima/Utilities

    Inputs (17)

    NameTypeDefaultDescription
    base_folderSTRINGoutputBase output folder (relative to ComfyUI root or absolute path).
    project_nameSTRINGprojectProject name - used as subfolder and in filename.
    base_nameSTRINGUser-supplied base filename. Leave blank to omit.
    collision_id_enabledBOOLEANtrueAdd 6-char random ID to prevent overwrites.
    collision_id_modeCOMBOnew_each_runnew_each_run = unique files; fixed = same ID across runs.
    timestamp_enabledBOOLEANtrueAdd timestamp to filename.
    timestamp_formatSTRING%Y%m%d_%H%M%SPython strftime format (e.g., %Y%m%d_%H%M%S).
    prefixSTRINGText to prepend to filename. Skip if blank.
    suffixSTRINGText to append before extension. Skip if blank.
    output_typeSTRINGLabel for output type (e.g., 'rgb', 'depth', 'mask'). Skip if blank.
    filename_orderCOMBOPRE,PRJ,BN,ET,SUF,TS,CIDOrder of filename components. PRE=Prefix, PRJ=Project, BN=BaseName, ET=OutputType, SUF=Suffix, TS=Timestamp, CID=CollisionID.
    separatorCOMBO_Character between filename parts.
    user_notesSTRINGOptional notes to pass to downstream saver nodes for metadata.
    external_projectoptSTRINGOverride project name from external source.
    external_folderoptSTRINGOverride base folder from external source.
    external_collision_idoptSTRINGUse specific collision ID (for matched outputs).
    allow_external_linkingoptBOOLEANfalseIf ON, this node broadcasts/receives OUTSIDE the Island (ignores group regex)

    Outputs (6)

    NameTypeDescription
    full_pathSTRINGComplete path including folder and filename (no extension).
    folder_pathSTRINGFolder path only.
    filenameSTRINGFilename only (no extension).
    collision_idSTRINGThe collision ID used (for matching related outputs).
    timestampSTRINGThe timestamp used.
    user_notesSTRINGUser notes passthrough for downstream savers.