FolderBatch Text Queue
One prompt per run, auto-advanced
- text_path
- file_name
- text_count
- line_index
The most common ComfyUI batch job has nothing to do with pixels: it's "generate an image for each of these 80 prompts." The standard workflow is one CLIP Text Encode, one prompt, one image, and a human doing the swapping. FolderBatch Text Queue is the iterator that turns a plain text file into a prompt pipeline - every execution it emits one text item, then advances to the next, optionally auto-queueing each run.
Unlike the other queues in this pack, it has two modes that compose. source_mode picks where text comes from: folder scans a directory for *.txt files, while file points at one single text file. unit_mode picks what counts as "one item": file means each text file is one item, line means each non-blank line of the file is one item. So you can queue a whole folder of prompt files, or one big prompt file line-by-line - the line mode is the one most people actually want for batch generation, because a 50-line prompts.txt is a lot easier to maintain than 50 files.
One rule the author enforces in code: source_mode=file only works with unit_mode=line. Pick file+file and the node raises a ValueError rather than guessing. Set start_at to resume mid-list, sort_by (Name/Date/Random) + order_by for traversal, and skip_empty_lines on for line mode so blank lines don't burn an execution.
The Text Queue also has a trick the other queues don't: repeat_count. It's an optional input that makes the queue hold each text item for N executions before advancing - set it to 3 and every prompt in your list generates three images before the queue moves on. The repeat_index optional input tracks where within the current item you are. Pair this with a seed that increments each run and you've got "N variations per prompt" with zero babysitting.
Outputs: text_path (current file path), file_name (base name, no extension), text_count (total items), and line_index - the original 0-based line number in line mode, or -1 in file mode. The canonical hookup is text_path and line_index into FolderBatch Load Text, then its text output into your positive-prompt conditioning.
Install is the pack's shared story: Manager, search "ComfyUI-FolderBatch", restart, no models, no extra deps. The one setup trap is matching skip_empty_lines on both sides - if the queue skips blanks but the loader doesn't, the line numbers drift and you'll get prompts landing on the wrong lines. Keep the flag identical on both nodes and the loop is genuinely set-and-forget.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| source_mode | COMBO | folder | 2 options: folder, file |
| unit_mode | COMBO | file | 2 options: file, line |
| folder | STRING | — | |
| text_path | STRING | — | |
| extension | STRING | *.txt | — |
| start_at | INT | 0 | — |
| auto_queue | BOOLEAN | true | — |
| sort_by | COMBO | Name | 3 options: Name, Date, Random |
| order_by | COMBO | A-Z | 2 options: A-Z, Z-A |
| skip_empty_lines | BOOLEAN | true | — |
| text_countopt | INT | 0 | — |
| progressopt | FLOAT | 0.0000–1 | — |
| repeat_countopt | INT | 1 | — |
| repeat_indexopt | INT | 0 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| text_path | STRING | — |
| file_name | STRING | — |
| text_count | INT | — |
| line_index | INT | — |