Batch Image Loader End
Batch Image Loader End is where the loop actually lives — and where your files die
- loop
- values
- count
- filenames
- value1
- value2
- value3
- value4
- value5
- value6
- value7
- value8
- value9
- value10
- value11
- value12
- value13
- value14
- value15
- value16
The name makes it sound like a closing bracket. It isn't. Batch Image Loader End is the part of this loop that does the work: it applies your file action, applies your rename action, then starts the next iteration or finishes. If you only read one of the two articles about this pair, read this one - the loop's whole behavior lives here.
What it's for
Two jobs, on purpose:
- Bookkeeping between iterations. Every image that comes through gets optionally moved, renamed, or deleted. This is the "process 400 files overnight and have them sorted when you wake up" pattern - renders moved to
done/, failures left in place by usingnone, source files deleted only after a save node has written the output. - State plumbing. Its sixteen value slots carry values back to the matching slots on Start, so a counter, an accumulated filename list, or a running total can survive across iterations.
How it works
End is registered as an output node, which in ComfyUI means it's a terminus the executor runs back from. Each iteration, in order:
- It waits for any connected value slots to resolve - the source marks them lazy, and the author's tooltip says it plainly: the node waits for connected values before touching the input file. So a value that depends on the current image is safe to wire in.
- It applies
file_action-nonekeeps the file,movemoves it,deleteremoves it. Move takes atarget_directory, relative to the loader's directory (defaultdone) or absolute, created if missing, with subfolders preserved. Name collisions get a_1suffix rather than an overwrite, so you won't silently lose a file to a naming clash. - It applies
rename_actionin the file's new location - unless the file was deleted, in which case rename isn't offered. - If there are files left, it clones the section of graph between the two nodes into the next iteration and hands it back to the executor. Otherwise it returns.
That last step is why the whole folder runs in one queue click, and why a big folder is a big graph: the body of your workflow gets duplicated per iteration, not looped in Python.
Inputs and outputs
loop- from Batch Image Loader Start. Not optional in any meaningful sense; the node does nothing without it.file_action-none,move(+target_directory), ordelete.rename_action-none;rename(filenameprefix plus a five-digit counter,name_00001_.ext, extension kept);suffix(appendssuffixbefore the extension);regex(regex_search/regex_replace, applied to the filename without extension, with\1/\g<name>group references supported).
Outputs: count, the number of processed images; filenames, all processed names one per line, only populated after the last iteration; and value1…value16 holding each slot's value after the last iteration. Like Start, it's marked always-dirty by design.
Installing it
ComfyUI Manager → search Nifty Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes
Restart. The pack's declared dependencies (color-matcher, imageio-ffmpeg) come along with a Manager install and aren't needed here. This is a small, single-author pack with essentially no community write-ups, so the README and the source are the documentation - and the source is unusually readable for a loop node.
Two caveats straight from the README: it's tested with frontend 1.39, and untested with Nodes 2.0. Anything built on graph expansion is exactly what a frontend rewrite disturbs.
Where people get burned
deleteis immediate and unconfirmed. There's no trash, no dry run. Do a first pass withnoneormoveon a duplicate folder and inspect the result.- Renaming is not idempotent in the obvious way. Regex mode rewrites the stem each time it sees the file, and
renamemode appends a counter - if both a move and a rename apply, read the tooltip order and test it on three files before trusting it on three hundred. filenameslooks empty mid-run. It's only available after the last iteration, so anything expecting the list during the loop (including values you feed back) is waiting on nothing.- Move targets resolve relative to the loader's directory, not the ComfyUI root.
doneinside a recursive run lands next to the images, not where you might expect from the Start node's absolute-path behavior. - Subfolder preservation cuts both ways. With
recursiveon, moving todonerecreates the tree - great for keeping structure, surprising if you wanted everything in one flat folder.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| loop | NIFTY_BATCH_LOOP | — | |
| file_action | COMBO | Applied to the input file of the current iteration. Runs before the rename action. | |
| valuesopt | COMFY_AUTOGROW_V3 | — |
Outputs (18)
| Name | Type | Description |
|---|---|---|
| count | INT | Number of processed images. |
| filenames | STRING | All processed file names, one per line. Only available after the last iteration. |
| value1 | * | Value of this slot after the last iteration. |
| value2 | * | Value of this slot after the last iteration. |
| value3 | * | Value of this slot after the last iteration. |
| value4 | * | Value of this slot after the last iteration. |
| value5 | * | Value of this slot after the last iteration. |
| value6 | * | Value of this slot after the last iteration. |
| value7 | * | Value of this slot after the last iteration. |
| value8 | * | Value of this slot after the last iteration. |
| value9 | * | Value of this slot after the last iteration. |
| value10 | * | Value of this slot after the last iteration. |
| value11 | * | Value of this slot after the last iteration. |
| value12 | * | Value of this slot after the last iteration. |
| value13 | * | Value of this slot after the last iteration. |
| value14 | * | Value of this slot after the last iteration. |
| value15 | * | Value of this slot after the last iteration. |
| value16 | * | Value of this slot after the last iteration. |