Dark Folders
Stop drowning in one giant output folder — let the node roll folders over by count
- change_on_input
- STRING
If you've ever stared at an output directory with ten thousand PNGs in it and given up on finding anything, DarkFolders is for you. It doesn't save images itself - it computes a folder name that rolls over once the folder hits a target size, and you hand that name to an image saver that supports a path input, like 'Save Image w/ Metadata' from the comfy-image-saver pack. Date-prefix folders help, sure, but when a single day's batch is a few thousand images you're back to square one. Count-based rollover is the fix.
How it works
Give it a folder_prefix (default batch-) and a folder_size (default 500). Every time it runs, it scans your ComfyUI output directory for folders matching the prefix, counts the files in each, and picks a folder per the selection_method. The output is a STRING path you wire into your saver's path field. The four selection methods:
- Fill Gaps - scan from
0up and use the first folder under the size limit (reuses empty or partial folders you've cleared out). - Highest Not Full - find the highest-numbered folder that actually has files; fill it if it has room, otherwise start the next one. The default behavior for the steady-state "batch of 8, size 16" flow.
- New Every Generation - ignore the size entirely; always create a fresh folder.
- Change On Input Change - keep filling the current folder until some
change_on_inputvalue changes, then start a new one. Thechange_on_inputsocket is typed*, so any signal works - a checkpoint name, a prompt, a seed.
It also quietly ignores folders that match the prefix but aren't numeric (like batch-abc), so stray folders don't crash the scan.
Gotchas worth knowing
The seed input is a dummy. The source is refreshingly honest about this: the node requires a seed it never actually uses, purely so ComfyUI re-evaluates it every batch. Change the seed to force a folder change. That's a hack, but a working one.
Counts are taken at batch start. The docstring admits a batch can overshoot folder_size - if a folder has 14 images and your batch adds 8 at size 16, it's going to 22 before it rolls over. If per-batch overshoot matters to you, size your folders above your batch size.
It needs a saver with a path option. Stock ComfyUI's Save Image doesn't take one. This node's output is meaningless without comfy-image-saver (or equivalent), so budget for that extra install. State for Change On Input Change is persisted to a JSON file in ComfyUI's temp directory, so clearing temp resets it.
Install
Manager → "DarkPrompts", or:
cd ComfyUI/custom_nodes
git clone https://github.com/darkpixel/darkprompts.git
Restart ComfyUI. No models, no pip deps. If you batch heavily, this is quietly one of the most useful organizational tools in the pack - the rest of DarkPrompts makes your prompts varied; this one keeps the results findable.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 00–18446744073709550000 | — |
| folder_prefix | STRING | batch- | — |
| folder_size | INT | 500 | — |
| selection_method | COMBO | 4 options: Fill Gaps, Highest Not Full, New Every Generation, Change On Input Change | |
| change_on_inputopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |