Load Image From Folder (Batch)
Run a whole folder through your workflow, one Queue click, then walk away
- IMAGE
- folder_path
- filename_stem
- filename_full
- current_index
- total_images
You've got 300 images that need captions, or upscaling, or a style pass, and your first instinct is to load each one, hit Queue, wait, load the next - an evening babysitting a graph. Load Image From Folder (Batch) is the fix: it hands you one image at a time from a real folder on disk, and when you pair it with the pack's Queue Next node, the workflow re-queues itself until the folder is empty. Click Queue Prompt once and leave.
It comes from hodgemann's ComfyUI-BatchFolderTools, a small four-node pack that exists to batch a folder of files through whatever single-file workflow you already have. Everything reads directly from disk - nothing is copied into ComfyUI's input or cache directory, so a folder with 10,000 images doesn't turn into 10,000 copies.
How it works
The node keeps a per-folder counter in memory. In sequential mode (the default) each execution loads the file at the current index, then bumps the counter before returning. When it runs out of files it raises an error before Queue Next gets a chance to re-queue, which is exactly why the loop stops cleanly instead of spinning forever - you'll see a ✅ ALL N IMAGES PROCESSED - DONE line in the console.
There's a subtle bit of plumbing that makes this work: the node's IS_CHANGED returns NaN in sequential mode, so ComfyUI treats it as "always changed" and never skips it via its execution cache. Without that, the second run would reuse the first run's output. It's the same always-rerun trick described in comfyui-node-plumbing.md.
The inputs that matter
- folder_path - the absolute path to your image folder.
C:\Users\me\imageson Windows,/mnt/c/...under WSL,/home/user/imagesor a mounted network share on Linux. This is the one you must get right. - mode -
sequential(auto-advance, what you want 99% of the time) ormanual(loads whateverindexsays, useful for testing one specific image). - skip_captioned - if you already have some
.txt/.caption/.capfiles sitting next to your images, enabling this skips those files at zero GPU cost. It's the pack's resume mechanism: crash or power loss, restart, flip this on, and the batch picks up where it died instead of redoing everything. - sort_by - controls which file comes first: alphabetical (default), reverse, or newest/oldest by modified or created time. Matters when filenames aren't sequential.
reset_counter is there to force the counter back to 0 if you need a clean re-run. index only does anything in manual mode.
What comes out
The IMAGE output is the current image as a standard ComfyUI IMAGE tensor, ready to wire into a VLM captioner, an upscaler, a KSampler - whatever your workflow does to a single file. The other outputs are metadata you'll want to wire along:
- filename_stem - the filename without extension (
photo_001). Wire this into the pack's Save Text File node so captions land next to the image that produced them. - folder_path - same path you typed; feed it back into Save Text File so files save right next to the source.
- filename_full, current_index, total_images - the full name, the 0-based index, and the count, useful for anything that needs to know where you are.
Installing it
Via ComfyUI Manager, search Batch Folder Tools and install, then restart. Or the old way:
cd ComfyUI/custom_nodes
git clone https://github.com/hodgemann/ComfyUI-BatchFolderTools.git
Restart ComfyUI. There are no model files to download - the image loader only needs Pillow and NumPy, which every ComfyUI install already ships. (The video loader in the same pack does need OpenCV; see that article.) The example captioning workflows additionally want a separate VLM pack, ComfyUI-QwenVL-Mod, with its own model download.
Where people get burned
- The classic one: the folder is a video folder, or contains unsupported extensions. It only looks for PNG, JPG, JPEG, WebP, BMP, TIFF, TIF and GIF - anything else is silently ignored, and if nothing matches you get a "No image files found" error.
- Forgetting to set mode to
sequential. In manual mode nothing auto-advances, so your "batch" processes the same file forever. - A crash or manual stop mid-run, then restarting ComfyUI: the in-memory counter is gone, so it restarts at 0 and redoes finished files. That's what
skip_captionedexists for - already-captioned files are skipped in a scan that never touches the GPU.
If you're captioning for LoRA training, one more thing, because it's the whole point of the exercise: the loader just moves files around, but what you save next to them is what your model learns from. On LLM-encoder bases (Flux, Z-Image, Qwen) write natural-language captions and describe what should vary while leaving the fixed stuff undescribed - the guidance in lora-training.md § Captioning still applies.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | Absolute path to image folder. Supports /mnt/ WSL paths, Linux, macOS, Windows, and network shares. | |
| mode | COMBO | sequential | sequential: auto-advances each execution. manual: uses the index widget. |
| index | INT | 00–9999999 | Image index (0-based). Only used in manual mode. |
| sort_by | COMBO | alphabetical | How to sort the files before indexing. |
| reset_counter | BOOLEAN | false | Reset the sequential counter back to 0. |
| skip_captioned | BOOLEAN | false | Skip images that already have a caption file. Checks for .txt/.caption/.cap next to the image. Use this to resume an interrupted batch. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| folder_path | STRING | — |
| filename_stem | STRING | — |
| filename_full | STRING | — |
| current_index | INT | — |
| total_images | INT | — |