FolderBatch Load Text
Read a whole file or one exact line — the loader that finishes your prompt pipeline
- text
FolderBatch Load Text is the small node at the end of the pack's text pipeline, and it earns its keep by answering the question nobody else answers cleanly: how do you get one specific line out of a text file, on command? It takes a text_path and, optionally, a line_index, and hands you a text STRING that's either the whole file or exactly the line you asked for.
The behavior is deliberately simple. Connect nothing to line_index (or wire in -1) and it reads the entire file as one string - a perfectly good "load my prompt template by path" node on its own. Connect a line_index of 0 or higher and it returns only that 0-based line. That's the whole trick, and it's what makes the batch loop work: the queue upstream says "next item is line 14," this node fetches line 14, and your prompt conditioning sees exactly the right text.
Two inputs are required: text_path (a forceInput STRING, meant to be wired from FolderBatch Text Queue) and skip_empty_lines (default true). The second one is where beginners get tripped up, and the README calls it out explicitly: when you're reading by line, skip_empty_lines on this node must match the setting on the queue, or your line indexes drift. The queue skips blanks when building its item list; if the loader then reads with a different skip setting, line 14 on one side is line 13 on the other. Set both the same and never touch them again.
Under the hood it's tolerant where you'd want it to be: files are read as UTF-8 with a BOM sniff (utf-8-sig), so the byte-order mark that Windows editors love to prepend doesn't become a garbage character at the start of every prompt. The output is one STRING, which drops straight into a CLIP Text Encode's positive prompt, a text-concat node, or anything that eats text.
There's nothing heavy here - no models, no audio, no video, just open() and a couple of string ops - which is why it sits at the boring end of the pack. But it's the node that makes the text queue a complete loop instead of half a feature, and as a standalone "load a prompt file by path" utility it beats core's text nodes for programmatic use.
Install is pack-standard: ComfyUI Manager → search "ComfyUI-FolderBatch" → restart, or git clone https://github.com/aiai-r/ComfyUI-FolderBatch into custom_nodes/. No extra dependencies beyond what ComfyUI already has. If the line you asked for doesn't exist, you get an empty string back - which, given skip_empty_lines, is your signal to double-check both nodes' flags.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text_path | STRING | — | |
| skip_empty_lines | BOOLEAN | true | — |
| line_indexopt | INT | -1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |