TimestampFileName
Never overwrite a save again — append the current time to any filename
- STRING
TimestampFileName is the simplest node in this pack and possibly the most quietly useful: you feed it a filename prefix, it appends the current date and time, and you get back something like miku_20260811_143022. Wire that into a SaveImage node's filename_prefix and every save gets a unique name, forever. No more "whoops, that batch just overwrote the last one."
In a pack full of randomness, this is the node that makes the randomness safe. Ranbooru re-rolls your prompt every run, RandomPicturePath re-picks a reference every run - that's great, until two runs land on the same filename and one silently destroys the other. A timestamp prefix is the one-line fix, and ComfyUI's built-in save nodes already append a numeric suffix for collisions; this makes every name unique from the start instead.
How it works
It's two lines of Python: grab datetime.now(), format it as %Y%m%d_%H%M%S (year, month, day, then hour, minute, second), and return f"{filename}_{timestamp}". It's one of the pack's always-rerun nodes, so it recomputes on every execution - which is exactly what you want, because it means the timestamp is fresh for each run rather than frozen at workflow-load time.
There's a caveat to the "always fresh" property: if you queue a batch in a single run, the timestamp is generated when the node executes, and ComfyUI's save node still appends its own counter. So the naming stays unique. Just don't expect sub-second resolution - if two separate runs happen within the same second, you can still collide. That's the one real edge case.
Inputs and outputs
filename- STRING, the prefix. Empty is allowed; you'd just get a bare timestamp.
Output: STRING, prefix + underscore + timestamp. Feed it to any filename_prefix input, or use it anywhere else a timestamped string helps.
Installing it
Part of the Ranbooru pack: ComfyUI Manager, search "Ranbooru", or
cd ComfyUI/custom_nodes
git clone https://github.com/Inzaniak/comfyui-ranbooru
then restart. No requirements.txt to worry about - it imports datetime and nothing else - and no model downloads.
Common issues
Not much to trip over with a node this size. The one thing people hit is expecting it to write the file - it doesn't. It only produces a string; the actual saving is still your SaveImage node's job. And the same-second collision above is real but rare in interactive use; if you're scripting thousands of images a second, you'd want finer-grained stamps, but for a person clicking queue, it's a non-issue. If you want the timestamp preserved in the filename across a restart rather than regenerated, keep in mind this node recomputes on every run - that's a feature for avoiding overwrites, not a way to keep one fixed name.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| filename | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |