Nodes/Louis Use/๐Ÿ“„ Folder Text Loader
ComfyUI Node

๐Ÿ“„ Folder Text Loader

Load every prompt in a folder as a list โ€” the lazy way to batch-iterate prompts

By LouisLU1997ยทCreated 4 months agoยทUpdated 2 months agoยท 0
๐Ÿ“„ Folder Text Loader
    • text
    • filename
    โ—„folder_pathโ–บ

    You've got fifty .txt files, each holding a prompt, and you want to run all fifty through the same generation pipeline. The naive way is a text file with one prompt per line plus a big-batch node - but then every variation shares a single giant batch and you can't do per-prompt anything. ๐Ÿ“„ Folder Text Loader does the list version: every .txt in a folder becomes one entry in an output list, and ComfyUI runs the downstream graph once per entry, in filename order.

    It's the text sibling of the pack's Folder Image Loader, and it inherits the same design philosophy: list output, native per-item execution, no manual looping. If you've ever written a script just to feed prompts into ComfyUI one at a time, this node is that script, in node form.

    What it gives you

    Two outputs, both lists, aligned by index:

    • text - the file contents, one per .txt file in the folder. This wires straight into a CLIP Text Encode, a prompt-enhancer, or this pack's Ideogram4 Text Encode.
    • filename - the base filename, so you can know which prompt is currently being processed and - the useful part - feed it to Batch Image Saver's ๅŽŸๆ–‡ไปถๅ to name each output after its source prompt. One wire and your batch outputs are automatically labeled lake_at_dusk.png, cyberpunk_alley.png, instead of img_00007.png.

    Like its image sibling, it hashes filenames plus modification times so new or edited .txt files re-trigger execution. Drop a file in the folder, hit run, it's picked up. Delete one, it's dropped.

    The workflow shape

    The cleanest setup: a folder of prompts, Folder Text Loader โ†’ text encoder โ†’ sampler โ†’ Batch Image Saver with ๅŽŸๆ–‡ไปถๅ connected. That's a complete "iterate over a folder of prompts, save each result named after its prompt" pipeline with four nodes and zero scripting. Toss in a folder of reference images via Folder Image Loader and you're building a mini prompt-to-image dataset runner.

    Installing it

    Part of the Louis Use pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/LouisLU1997/ComfyUI-louis-use Louis_use
    

    Or "Louis Use" in ComfyUI Manager, then restart. No extra dependencies.

    What to watch

    • Only .txt files are read - the folder's other files are ignored, so keeping prompts in a dedicated folder avoids surprises.
    • Empty folder โ†’ error. Like its sibling, no text files means a ValueError. Don't point it at an empty directory.
    • List semantics downstream. The text output is a list, which means each item runs through the graph as a separate execution. Nodes that can't handle list inputs will complain - that's the list mode working, not a bug.
    • File order = filename order. Sorted by name, so number your files if order matters (001_..., 002_...).

    For prompt sweeps, A/B testing variations, or regenerating a set of named outputs, this is one of those nodes you install once and end up using more than you expected.

    CategoryLouis_use

    Inputs (1)

    NameTypeDefaultDescription
    folder_pathSTRINGโ€”

    Outputs (2)

    NameTypeDescription
    textSTRINGโ€”
    filenameSTRINGโ€”