Scan Images Dir (延遲模式)
Scan a folder without loading a single image
- filenames
- full_paths
- directory
- total_files
- status
Despite the name, this node doesn't load images at all - and that's the point. Load Images From Dir Lazy (labeled "Scan Images Dir / 延遲模式" in the menu) just scans a folder and hands you back the list of filenames and full paths as strings, plus the total count. No pixels, no memory hit, no matter how enormous the directory is.
It's the front half of the lazy batch pattern that runs through aidec's pack. The idea: scan the folder once to get the file list and its length, then let a queue counter walk that list, pulling one actual image at a time with Load Image By Index only when it's that file's turn. Compared to loading a whole directory as a batch - which can cost gigabytes for a few hundred images - this keeps everything flat. You're passing around a list of names, which is basically free.
How it works
It reads the directory entries, filters to images, and returns the names and paths as comma-joined strings along with a count. That's the entire operation - it never touches image data, so it's fast and cheap regardless of folder size. The strings it emits are exactly the shape the pack's other nodes (Image Filename Processor, the queue processors) expect to consume.
The inputs that matter
- directory (required) - the folder to scan. The only thing it truly needs.
- start_index (optional) - skip the first N files if you want to begin partway in.
- max_files (optional) - cap how many entries it lists; 0 means all of them. Useful for testing on a slice before committing to the full folder.
Outputs: filenames (comma-joined names), full_paths (comma-joined complete paths), directory (echoed back), total_files (the count), and status. Feed total_files into a loop bound, and pass filenames or full_paths into whatever picks out a single entry by index.
Installing it
cd ComfyUI/custom_nodes && git clone https://github.com/aidec/Comfyui_TextBatch_aidec, then restart ComfyUI (or ComfyUI Manager → Install via Git URL). No models, no heavy dependencies. It sits under the image category.
Where people get burned
- Expecting images out of it. The name says "Load Images," but there's no IMAGE output here - only strings and a count. If you wanted actual pixels, that's Load Image By Index (one at a time) or Load Images From Dir Batch (the whole batch). This node is deliberately the scan-only step.
- File ordering. The list comes back in the directory scan's order, usually alphabetical - so
img10can sort ahead ofimg2unless your names are zero-padded. If your queue relies on a specific sequence, pad the filenames. - Server-side paths. On a hosted or serverless ComfyUI, the folder has to exist on the server, not your local disk.
Think of it as the manifest step: scan first, get your list and count, then let the rest of the pack process the folder one lazy image at a time. If you'd rather not wire the pieces yourself, Image Queue Processor Pro rolls the scan, the counter, and the per-image load into a single node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| start_indexopt | INT | 0 | — |
| max_filesopt | INT | 0 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| filenames | STRING | — |
| full_paths | STRING | — |
| directory | STRING | — |
| total_files | INT | — |
| status | STRING | — |