Nodes/ComfyUI_Fill-Nodes/FL Directory Crawl
ComfyUI Node

FL Directory Crawl

Load a whole folder of images or text into ComfyUI as a batch

By filliptm·Created 3 years ago·Updated about 17 hours ago· 628
FL Directory Crawl
    • image_batch
    • text_content
    • image_list
    directory_path
    file_type
    max_files100
    start_index0

    The node for "I have a folder of 500 images or captions and I need them in my graph as a batch." Point it at a directory, it recursively walks every subfolder, and hands you back either images or text files, batched, with progress tracking so you're not staring at a frozen queue wondering if it's hung.

    The mechanism

    It walks directory_path recursively, filtered by file_type, respecting max_files as a hard cap and start_index as an offset - so if you're working through a large dataset in chunks, you page through it by moving start_index forward across runs instead of reloading everything each time. For images it gives you two output flavors simultaneously: a padded batched tensor (for anything downstream expecting a uniform IMAGE batch) and a plain Python list of individual images (for chains that want to iterate one at a time without a forced-uniform batch's padding artifacts).

    Inputs and outputs that matter

    directory_path is the folder to crawl - subfolders included automatically. file_type is images or text, one or the other per node instance, not both at once. max_files (1-10000, default 100) caps how many entries load in one pass; start_index (0-10000, default 0) is your paging offset into a larger set.

    Outputs: image_batch (padded IMAGE batch - every entry forced to a common size even if the sources differ in dimensions), text_content (STRING, populated when file_type is text), and image_list (IMAGE, is_list - the unpadded per-image version). Wire image_batch into anything expecting a standard batch; wire image_list into anything iterating images one by one where you don't want padding-induced resizing on mismatched aspect ratios.

    Installing it

    ComfyUI Manager: search Fill-Nodes, install, restart. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/filliptm/ComfyUI_Fill-Nodes, then restart. Nothing else to install - this is filesystem I/O, not an API integration.

    Where people get burned

    "Padded" batching means images of different dimensions get forced to a common size before batching, which can look like resizing or cropping you never asked for if your source folder isn't uniform - if you need originals untouched, work off image_list instead of image_batch. max_files is a hard cap per run, not a "load everything, I promise it fits" setting: if the folder has more files than max_files, only the first batch (starting at start_index) comes through, so paging a big dataset means bumping start_index and re-running, not cranking max_files to 10000 and hoping. And directory_path needs to be a real path on the machine ComfyUI is actually running on - on a hosted or serverless instance, that's a path inside that environment, not on your laptop.

    Category🏵️Fill Nodes/Utility

    Inputs (4)

    NameTypeDefaultDescription
    directory_pathSTRING
    file_typeCOMBO2 options: images, text
    max_filesINT1001–10000
    start_indexINT00–10000

    Outputs (3)

    NameTypeDescription
    image_batchIMAGE
    text_contentSTRING
    image_listIMAGE