Load Prompts From Dir
Point it at a folder of prompts and let the queue do the work
- PROMPT
- FILE_PATH
Load Prompts From Dir is the reason the ComfyUI_PromptBatcher pack exists. It points at a folder full of .txt files, reads each one as a prompt, and hands ComfyUI a list of prompt strings plus the file paths. Wire that list into your sampler or conditioning and you've turned "generate 50 images one at a time, copying prompts around by hand" into "queue the whole batch and walk away." For anyone doing prompt-variety runs - wildcards, character sheets, style explorations - this is the boring-but-effective version of that workflow.
The nice thing about the ComfyUI way of thinking here: this node outputs lists (both outputs are list-typed), so ComfyUI's batch machinery does the looping for you. One execution reads the folder, and the downstream sampler runs once per prompt in the list. You get reproducibility, too - the batch lives on disk as plain text files, which is a lot easier to version and reuse than a pile of node text widgets.
How it works
The loader is pure Python stdlib - no dependencies, no models, nothing to download. Here's what it actually does:
- Lists the folder, keeps only
.txtfiles (case-insensitive), and filters to names starting with file_prefix if you set one (also case-insensitive). - Sorts files by the first number found in the filename, not alphabetically - so
prompt2.txt,prompt10.txt,prompt100.txtland in the order you'd expect, not10, 100, 2. - Applies start_index (skip the first N files) and then file_load_cap (stop after N files; 0 means no limit).
- Reads each file, strips surrounding whitespace, and returns the list of prompts plus the absolute paths.
The three inputs you'll actually touch:
- directory - required. The path to your prompt folder.
- file_load_cap - default 0 (no limit). Set it to, say, 10 to do a dry run before committing to the full 300-file batch.
- load_always - default off. When enabled, it forces a fresh read of the folder on every execution, which matters if the files change between runs. Leave it off for normal use - it re-reads only when something else changes, which is faster.
That's the whole input list. start_index and file_prefix exist for splitting one folder into ranges, which is a genuinely useful trick when a batch dies partway through and you want to resume from file 40 without rebuilding anything.
Outputs
- PROMPT - the list of prompt strings. This is the one that matters; wire it into your CLIP text encode / KSampler path.
- FILE_PATH - the list of absolute paths, useful if you want to echo "which file am I on" into a workflow or save results keyed to the source prompt.
Install
ComfyUI Manager: search "ComfyUI_PromptBatcher" and install. Or manually:
cd ComfyUI/custom_nodes/
git clone https://github.com/synthetai/ComfyUI_PromptBatcher
Restart ComfyUI. Zero extra dependencies, MIT licensed, nothing heavy. This is one of those packs where "no pip install needed" is the whole pitch.
Gotchas
- directory is used as-is - it's checked literally, not resolved against ComfyUI's
inputfolder. That's a subtle inconsistency with the pack's siblingSaveTextToFiles, which does resolve relative paths underinput. Give the loader an absolute path and save yourself the headache. - If the folder is missing, empty, or has no matching
.txtfiles, the node throws aFileNotFoundErrorand the batch won't run - so a typo'd path fails loudly, not silently. - Individual files that fail to read are skipped with an error printed to the console, not a hard crash. You can end up with a shorter batch than you expected, so glance at the log if your count looks off.
- Files without numbers fall back to string sorting, and only the first number in a name is used for the numeric sort -
shot2_alt.txtandshot10.txtsort by 2 and 10, so name your files with the number up front.
For a small pack by an unknown author, this is refreshingly predictable. It won't change your life, but if your prompt lists live in text files, it's the cleanest two-minute way to make them drive a whole queue.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| file_prefixopt | STRING | — | |
| file_load_capopt | INT | 0 | — |
| start_indexopt | INT | 0 | — |
| load_alwaysopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| PROMPT | STRING | — |
| FILE_PATH | STRING | — |