Add File Name Prefix Advanced
Bake dates and run variables into your ComfyUI filenames
- path
- input_variables
- STRING
Plain Add File Name Prefix gives you a fixed filename string. This one gives you a filename that can carry information about the run that produced it - a timestamp, a seed, a checkpoint name, whatever you want baked into the file on disk instead of buried in the PNG's embedded workflow metadata. If you've ever dug through a folder of ComfyUI_00047_.png files trying to remember which one used which settings, this node is the fix.
The two things it adds over the plain version
Datetime stamping, same idea as its Add Folder Advanced sibling: set add_date_time to prefix or postfix and a formatted timestamp gets glued onto your filename automatically, using a strftime format string you control. Handy for batch runs where you don't want to think about uniqueness - the timestamp does it for you.
Variable formatting is the bigger deal. Drop {} into your file_name_prefix string and it gets replaced with whatever you feed into input_variables - so a prefix like "portrait_{}" combined with a seed value becomes portrait_482910573 on disk, no manual bookkeeping required. For more than one variable, comma-join the values (order matters, left to right) - which is exactly the job of the Join Variables node elsewhere in this pack, so you're not hand-building that comma string yourself.
The inputs and outputs that matter
path(required) - thePATHfrom your Create Project Root / Add Folder chain, same as the plain version.file_name_prefix(required) - your prefix string, with optional{}placeholders.add_date_time(required, enum) -disable,prefix, orpostfix.date_time_format(required, default%Y_%m_%d_%H:%M:%S) - strftime format, fully customizable.input_variables(optional) - the value(s) substituted into your{}placeholders. Accepts pretty much any type and attempts to stringify it, but the author's own note applies here too: feed it something like a rawLATENTand it'll break, so keep it to strings, numbers, and things that print cleanly as text.
Output is a STRING - wire it straight into SaveImage's filename_prefix.
How to install it
ComfyUI Manager: search ComfyUI-Path-Helper, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Billius-AI/ComfyUI-Path-Helper
Restart ComfyUI. No pip requirements, no model downloads - the whole pack is Python's os and datetime doing the work, so install is just a git clone and a restart.
Common issues & troubleshooting
{} shows up literally in my filename instead of getting replaced. input_variables isn't connected, or is connected to nothing meaningful. There has to be an actual value flowing into that input for the substitution to happen.
I tried a Primitive node into input_variables and it did nothing. This is a documented gap in the pack - Primitive nodes don't work as the source for input_variables. Route through a real value output instead (a seed, a string, anything with a concrete upstream type).
Formatting throws an error partway through a run. You're likely feeding a type this can't cleanly turn into text - LATENT is the specific example the author warns about, but anything unusual is a risk since the input is intentionally unrestricted. If you're not sure what a value looks like as a string, check it with Show String first before wiring it into input_variables.
Filenames from the same batch are colliding or overwriting. Turn on add_date_time (prefix or postfix) if you haven't - that alone solves most collision problems in repeated batch runs, without you having to manually vary the prefix each time.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| path | PATH | — | |
| file_name_prefix | STRING | — | |
| add_date_time | COMBO | 3 options: disable, prefix, postfix | |
| date_time_format | STRING | %Y_%m_%d_%H:%M:%S | — |
| input_variablesopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |