Text File Iterator (Warper)
Fixed, incremental, or seeded-random access to your prompt files
- text_content
Folder-of-.txt-files workflows come in three flavors: "always this one," "next one each run," and "surprise me - but reproducibly." Text File Iterator (Warper) gives you all three behind one mode dropdown, which is why it's the flexible one of the pack's text-loading nodes. Point it at a directory, pick a mode, and it hands back a single text_content string. Same inputs as its sibling, but this one remembers state in incremental mode - the thing that makes sequential prompt walks actually work.
It's from ComfyUI Warper Nodes, the niche pack by workflow author AIWarper. It sits alongside Load Single Prompt by Index (Warper) (deterministic index access) and Text File Iterator with Info (Warper) (this, plus metadata). If you need to know which file you got, grab the with-info version instead.
How it works
Three inputs:
directory_path- where the.txtfiles live.index- interpreted differently per mode.mode- the star input:fixed,incremental, orrandomized.
In fixed, the index is used directly with bounds checking - same as the single-prompt loader. In incremental, the node keeps a class-level dictionary of "last position" per directory path, serves you that file, and advances for next time, wrapping around at the end. In randomized, the index becomes a seed: random.seed(index) then pick one, which means the same index always gives the same file - reproducible randomness, and it resets the global random state afterward so it doesn't disturb other nodes. Files are globbed *.txt and sorted by name in every mode.
Output is a single text_content string - feed it to a CLIP text encoder or a prompt builder like Combine Prompts (Warper).
Installing it
Standard Warper install: ComfyUI Manager → search "ComfyUI-WarperNodes" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AIWarper/ComfyUI-WarperNodes
# restart ComfyUI
Pure file I/O, no dependencies beyond the standard library. No models, no downloads - the README's RAFT checkpoint is for Flow Visualizer only.
Common issues
Incremental mode's memory is the feature and the trap: it remembers position per directory path for the whole ComfyUI session, so rerunning a workflow doesn't reset to zero - if you expected file one again, you'll get the next file. That's by design ("remembering position between runs"), but it makes incremental mode awkward for reproducible batches; for those, use fixed with a counter or the randomized seed. Empty or invalid results come back as an empty string, silently - a missing directory, no .txt files, or an out-of-range fixed index all read as "". And because randomized reseeds on the index, "random" is only random across different indexes; same index, same file, forever. Which is usually what you want, but it surprises people who expected true RNG.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| directory_path | STRING | — | |
| index | INT | 00–10000 | — |
| mode | COMBO | fixed | 3 options: fixed, incremental, randomized |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text_content | STRING | — |