Batch_text_saving
Numbered text saving that finally makes batch logging painless
- image
- text
- image
- next_number
You're running 40 prompts in a row and you want a text file per prompt, numbered, so you can match generations to their prompt later. The core Save Text node makes you babysit filenames. Batch_text_saving is the "set it and forget it" version: it writes your text to disk with a number baked into the filename, bumps that number automatically on every run, and - this is the part that makes it worth installing - hands you the next number on an output socket so a loop can feed it forward.
It comes from the AIGCZero/ComfyUI-tools_zero pack, a grab bag of Qwen prompt helpers, VRAM tools and batch utilities from a Chinese developer. Most of the pack is Chinese-first; this node's labels are in English, which is a pleasant surprise. It's an output node, so ComfyUI always runs it even when nothing downstream depends on it - exactly what you want from a logger.
What it actually does
Give it text and it writes N_filename.txt (or filename_N.txt, your pick) into whatever folder you name. Turn overwrite off and it appends instead of clobbering. Choose csv and each line of your text becomes one row in a CSV - handy if you want to load results back into a spreadsheet later. It can also save an image with the same base name, so prompt + frame land side by side.
The clever bit is the counter. Set name_number to 1 and run five times; you get files 1 through 5, because the node remembers the highest number it has seen in the class variable, not just on this node instance. And the third output, next_number, carries the counter forward - wire it into name_number of the next node in a batch and your numbering survives a loop.
The inputs that matter
- output_file_path - the directory to write into. Leave it empty (or the file name empty) and the node does nothing but warn you.
- file_name - base name; the number gets attached before or after it per
number_position. - overwrite -
truerewrites the file each run,falseappends. Append mode plus a fixed name is how you build one growing log across a batch. - name_number - where the counter starts.
The optional text input is what you're actually saving, and image saves a PNG alongside. Outputs are text, image, and next_number - wire next_number into the next saver and you never name a file by hand again.
Installing it
The whole pack installs as one unit. ComfyUI Manager → search "ComfyUI-tools_zero", or:
cd ComfyUI/custom_nodes
git clone https://github.com/AIGCZero/ComfyUI-tools_zero
Then restart ComfyUI. The pack pulls in transformers, bitsandbytes, and qwen-vl-utils because most of it is LLM machinery - this node itself only needs Python's stdlib plus what ComfyUI already ships, so it costs you nothing extra in VRAM or disk.
Gotchas
Two things bite people. First, if you disconnect text, the node happily runs and writes nothing - there's no error, just a warning in the console, so check your wire if files stop appearing. Second, the counter is class-wide, not per-node: drop two Batch_text_saving nodes into one workflow and they share the numbering. That's usually fine, but if a fresh batch needs to start at 1 again, set name_number explicitly rather than trusting the default. Also note output_file_path is taken as-is when absolute; relative paths resolve under your ComfyUI output directory.
It's a small node, but it kills one of those recurring workflow chores - logging prompts while you batch - and it does it without ceremony.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| output_file_path | STRING | — | |
| file_name | STRING | — | |
| file_extension | COMBO | 2 options: txt, csv | |
| overwrite | BOOLEAN | true | — |
| name_number | INT | 10–99999 | — |
| number_position | COMBO | before | 2 options: before, after |
| textopt | STRING | — | |
| imageopt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| image | IMAGE | — |
| next_number | INT | — |