Build Path
Build a save path that's actually a folder, not a fire hazard
- path
If you generate images for more than a week, your output folder turns into a flat landfill. Build Path is StringKit's answer: it assembles a folder path out of up to ten segments, joins them with /, and - this is the good part - sanitizes every segment so the result is a path Windows won't reject and a folder you can actually find again. Type 2026-08-23/sunset/beach/smile as segments and out comes 2026-08-23/sunset/beach/smile, ready to feed a save node.
What you set
- segment_size - 1 to 10, how many segment boxes are visible. The extra boxes fold away, like the socket count on Join Texts.
- fix_invalid_chars - on by default. This is the fire-prevention toggle, and it's the reason to use this node at all.
- segment_1 … segment_N - the path pieces. You can type them directly or drag a link onto a segment. That last part is the workflow-saver: wire your Unpack Text
titleoutput straight into a segment and every image lands in a folder named after its prompt, no text node in between.
With fix_invalid_chars on, each segment gets scrubbed: \ / : * ? " < > | and control characters become _ (so a title like smile:1.1 won't break the path), trailing dots and spaces are removed, and Windows-reserved names like CON, PRN, NUL, COM1–LPT9 get a _ prefix so they don't silently vanish. Turn it off and a / inside a segment survives - one segment becomes several path levels, which is occasionally exactly what you want.
Date tokens, done properly
%year%, %month%, %day%, %hour%, %minute%, %second% are expanded by the node itself, and all segments use the same timestamp within a run, so a folder won't fracture across a midnight boundary. There's also an IS_CHANGED hook: the node returns the expanded path as its cache signature, so when the date rolls over it re-runs instead of serving you yesterday's cached folder. That's a subtle bug killer - without it, ComfyUI's aggressive caching would happily write today's images into yesterday's directory.
One mismatch to know about: ComfyUI's own %date:yyyy-MM-dd% token is not supported here. That format is expanded by the frontend for widget values only, so it never fires on strings arriving via links. Use StringKit's %year% family instead.
Install
Ships in ComfyUI-StringKit - MIT, pure Python, no models or dependencies. ComfyUI Manager (search ComfyUI-StringKit) or:
cd ComfyUI/custom_nodes
git clone https://github.com/luku756/ComfyUI-StringKit
Restart ComfyUI completely afterward; the collapsing segments are frontend JS. Found under the StringKit category.
Wire the path output into a save node's filename prefix and you get self-organizing folders: date on top, prompt title below. Filenames are cosmetic in ComfyUI - the workflow lives in the PNG - but folders you can navigate are not, and this is the rare string node that actually pays you back in sanity.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| segment_size | INT | 41–10 | — |
| fix_invalid_chars | BOOLEAN | true | — |
| segment_1 | STRING | — | |
| segment_2 | STRING | — | |
| segment_3 | STRING | — | |
| segment_4 | STRING | — | |
| segment_5 | STRING | — | |
| segment_6 | STRING | — | |
| segment_7 | STRING | — | |
| segment_8 | STRING | — | |
| segment_9 | STRING | — | |
| segment_10 | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| path | STRING | — |