D2 Filename Template
Stop hand-typing date-stamped output names
- STRING
Every serious ComfyUI user eventually hits the moment where their output/ folder is a graveyard of ComfyUI_00001_ files and they can't tell which run was which. D2 Filename Template is the D2 pack's answer: a string-building node that stitches dates, node parameters, and values from other nodes into a filename (or any string you need), with sanitization so the result doesn't break your filesystem.
It's built around a small template language, and the author's own tooltip is the best summary:
%date:{yyyy/MM/dd/hh/mm/ss}%- date/time parts%node:{id}.{key}%- grab a value from another node by its ID and property, e.g.%node:8.width%%arg_1%- embed the value on this node's arg input%arg_1:ckpt_name- same, but with.safetensorsstripped off
You'll most often use it for output naming: feed the string into D2's Save Image filename_prefix and suddenly every render carries a readable name like anima_2026-08-16_1024x1024.
The inputs that matter
format- the template string. This is where the magic lives; the syntax above is all you need for 90% of uses.arg_count- how manyarg_1..arg_Ninput sockets you want (1 to 50). Wire other nodes' outputs here.normalization- filename sanitization. Keep it on; it scrubs characters that'll make Windows (or your sanity) unhappy.seed- lets the output vary per run if you bake it into the format.
Beyond the basics, the template engine can reach into arrays, dicts, and objects: %exec_1[0]% grabs element zero from an array fed into arg_1, %exec_1['key']% pulls from a dict, and %exec_1.key% reads a property off an object. That last one is how you'd pull steps and sampler_name straight off a d2_pipe object. There are also presets for common formats like A1111-style metadata, editable in custom_nodes/D2-nodes-ComfyUI/config/template_config.yaml.
Output
One STRING - your assembled template.
Installing it
ComfyUI Manager, search "D2-nodes-ComfyUI", or:
cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI
Restart after. No model downloads, deps are just piexif and charset-normalizer. Post-v32.0.0 the pack assumes a recent ComfyUI (V3 schema); on older builds use a version before 32.0.0.
Watch out for
The single-line format here means long expressions get cramped - the pack ships a second node, D2 Filename Template2, which is literally this node with a multiline format field, so switch to that if you're building anything complicated. And remember the arg sockets only appear after you set arg_count - start with the defaults and add from there.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| format | STRING | Datetime -- %date:{yyyy/MM/dd/hh/mm/ss}% Node param -- %node:{id}.{key}% arg_1-3 -- %arg_1% Delete .safetensors -- %arg_1:ckpt_name | |
| arg_count | INT | 31–50 | — |
| normalization | BOOLEAN | true | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |