Nodes/ComfyUI Warper Nodes/Load Prompts from Directory (Warper)
ComfyUI Node

Load Prompts from Directory (Warper)

Batch-generate from a folder of txt prompts

By AIWarper·Created about a year ago·Updated 8 months ago· 14
Load Prompts from Directory (Warper)
    • prompts
    • total_loaded
    • file_names
    directory_path
    skip_first_files0
    load_cap10

    The most boring part of batch generation is typing the same dozen prompts into the graph over and over. Load Prompts from Directory (Warper) turns a folder of .txt files into your batch source: point it at a directory and it reads the prompt files, sorted by name, into a list you can feed a batch workflow. Combined with skip_first_files and a load_cap, it becomes the loading stage of a real batch pipeline - think a prompt library you iterate through without ever editing the graph again.

    It's part of the prompt-loading trio in ComfyUI Warper Nodes, the niche pack by workflow author AIWarper. The README's own use case nails it: "perfect for batch processing multiple prompts or iterating through a prompt library with an incremental counter node." If you've got a stable, polished workflow and just want to swap in prompts by the dozen, this is the node that lets the graph sit still while the inputs move.

    How it works

    Three inputs do the whole job:

    • directory_path - where the .txt files live. Supports ~ expansion; a relative path resolves against ComfyUI's working directory, so absolute paths are the safe habit.
    • skip_first_files - how many files to skip from the front. The intended pairing: drive it with an incremental integer counter so each batch run walks forward through your library without re-reading everything.
    • load_cap - max prompts to load at once (default 10, up to 1000).

    Files are globbed as *.txt and sorted by filename, so name them 01_style.txt, 02_theme.txt if you care about order. Each file's content is read and stripped of leading/trailing whitespace. Outputs: prompts (a list of strings - this output is a true list, marked OUTPUT_IS_LIST), total_loaded (an int you can use for progress), and file_names (the matching list of filenames, handy for keeping track of which prompt produced which image).

    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 model, no heavy deps. The README's RAFT download is for Flow Visualizer only.

    Common issues

    The fail-soft returns are the thing to internalize: a missing directory, a path that isn't a directory, zero .txt files, or a skip_first_files that exceeds the file count all return ([""], 0, [""]) - an empty prompt and zero loaded, not an error. That's graceful, but it means an empty prompt can sail silently into your sampler and produce a garbage image. Check total_loaded before trusting the run. The prompts output is a list, so don't wire it into a node expecting a single STRING without a list-aware consumer. And remember the sort is by filename - if your library has no zero-padded names, "file10.txt" sorts before "file2.txt," which will scramble your intended order.

    CategoryWarper Tools/Prompts

    Inputs (3)

    NameTypeDefaultDescription
    directory_pathSTRING
    skip_first_filesINT00–10000
    load_capINT101–1000

    Outputs (3)

    NameTypeDescription
    promptsSTRING
    total_loadedINT
    file_namesSTRING