Nodes/CRT-Nodes/Text Loader Crawl (CRT)
ComfyUI Node

Text Loader Crawl (CRT)

Text Loader Crawl (CRT)

By PGCRT·Created 2 years ago·Updated a day ago· 132
Text Loader Crawl (CRT)
    • text_output
    • file_name
    • file_path
    folder_path
    seed0
    file_extension.txt
    max_words0
    crawl_subfoldersfalse
    interleave_subfoldersfalse
    remove_extensionfalse

    Text Loader Crawl (CRT) reads a text file out of a folder on disk and hands you its contents as a string, chosen deterministically by a seed. It's built for the "batch of prompts on disk" workflow: you keep a folder of prompt files, and this node decides which one to load - reproducibly - without you touching the graph between runs.

    Here's the pattern it's made for. You've got a folder of prompt .txt files (or a couple hundred, or a few thousand). Text Loader Crawl scans the folder, picks a file, and hands the text to your prompt encoder. Change the seed and it picks a different file. Run the same seed and it picks the same file - every time. That determinism is the whole trick: you can reproduce any specific prompt from the batch just by dialing the seed back, which is exactly what you want when you're generating a batch of variations and one of them turns out great. There's even an optional max_words limit if you only want the first N words of a longer prompt.

    The mechanics are simple but worth knowing. Files are scanned and sorted, and selection is seed % number_of_files - so with 10 files, seeds 0 through 9 hit each file once and then they cycle. The file list is cached per folder and re-scanned when the folder's modification time changes, which keeps it from re-listing a huge directory on every queue unless something actually changed. It supports crawl_subfolders (default off) to recurse, and remove_extension to output the filename without its suffix.

    Inputs you'll actually set: folder_path (absolute path to your prompts folder), seed, and file_extension (default .txt, so you can point it at .md or anything else). Outputs are text_output (the file's contents), file_name, and file_path. One wrinkle to know: file_path returns the containing folder of the chosen file, not the full file path - handy for feeding the folder location onward, but don't assume it's a path to the file itself. And if the folder is missing or empty it returns empty strings rather than crashing, so you can leave the node in a workflow and fix the path later without breaking the queue.

    Install with the pack: ComfyUI Manager → search "CRT-Nodes", or git clone https://github.com/plugcrypt/CRT-Nodes.git into custom_nodes and restart. It's pure filesystem + Python, so no models and no heavy deps. It pairs nicely with Text Loader Crawl Batch (the batched variant that loads several files at once) and Save Text With Path (CRT) on the output side if you want to write results back to disk in the same style.

    CategoryCRT/Load

    Inputs (7)

    NameTypeDefaultDescription
    folder_pathSTRINGPath to the folder containing text files
    seedINT00–18446744073709550000Seed for deterministic file selection
    file_extensionSTRING.txtFile extension to filter (e.g., .txt, .md)
    max_wordsINT0Maximum number of words in output (0 for no limit)
    crawl_subfoldersBOOLEANfalseIf true, include files in subfolders
    interleave_subfoldersBOOLEANfalseWhen crawling subfolders with incrementing seed: if ON, iterate through each folder's 1st file, then each folder's 2nd file, etc. If OFF (default), iterate through all files in folder 1, then folder 2, etc.
    remove_extensionBOOLEANfalseOutput filename without extension

    Outputs (3)

    NameTypeDescription
    text_outputSTRING
    file_nameSTRING
    file_pathSTRING