FolderBatch Sync Queue
The node that keeps image + prompt + audio in lockstep through a whole batch
- base_name
- image_path
- video_path
- text_path
- line_index
- audio_path
- item_count
Here's the workflow that breaks everyone eventually: you've got a folder of reference images, a matching txt file for each one with its prompt, and maybe an audio clip per item for a lip-sync or dubbing job. You want to process them as sets, in order, without the image and its prompt drifting apart by item 40. FolderBatch Sync Queue is the pack's flagship because it's the node purpose-built for exactly that: it queues synchronized items across image, video, text, and audio at once, and emits all the paths for one item together, each execution.
The mechanism is a four-way join over folders. You enable whichever media types you need with the use_image / use_video / use_text / use_audio toggles, give each its own folder (or leave them blank to fall back to common_folder), and set the match rule with sync_mode. By Name joins on base filename - cat.png, cat.txt, and cat.mp3 count as one item because they share the name "cat." By Order joins on sorted index instead, which is what you want when files don't share names but are each numbered to line up. text_unit_mode flips between one text file per item and one line per item, the latter expanding each matched text file into multiple items so you can drive a whole batch from a single prompts file.
missing_policy is where you decide how strict the join is. Skip only emits complete sets - if an image has no matching txt, that item never appears, which is the safe default for long runs. Empty keeps the item but hands you an empty string for whatever's missing, so a missing prompt becomes "generate with nothing" rather than a skip. Error stops the whole run the moment a set is incomplete and names the missing files - harsh, but invaluable for catching a broken export before you've burned fifty generations. In By Order mode, Error also refuses to run if the folders have different item counts.
Outputs are the full handoff for one item: base_name (the matched name), image_path, video_path, text_path, audio_path, line_index (-1 in file mode, else the 0-based line), and item_count for the total. Wire each path you care about into the matching FolderBatch loader - Load Image, Load Video Frames, Load Text, Load Audio - and process each synchronized set.
Everything else is the shared pack story: start_at to resume, auto_queue to self-advance, sort_by/order_by for traversal, and the item_count/progress optional inputs are UI display only. Install via Manager (search "ComfyUI-FolderBatch") or git clone https://github.com/aiai-r/ComfyUI-FolderBatch into custom_nodes/; no models, no extra Python deps.
The trap to respect: the whole item list is cached per node instance, keyed on every folder, extension, and mode setting. Fix a folder or toggle a media type mid-run and the cache resets - but purely cosmetic changes keep it. And in line mode, keep skip_empty_lines in agreement with Load Text, or your line indexes quietly shift. Get those two details right and this is the most "set it and forget it" node in the pack.
Inputs (23)
| Name | Type | Default | Description |
|---|---|---|---|
| common_folder | STRING | — | |
| sync_mode | COMBO | By Name | 2 options: By Name, By Order |
| missing_policy | COMBO | Skip | 3 options: Skip, Error, Empty |
| start_at | INT | 0 | — |
| auto_queue | BOOLEAN | true | — |
| sort_by | COMBO | Name | 3 options: Name, Date, Random |
| order_by | COMBO | A-Z | 2 options: A-Z, Z-A |
| use_image | BOOLEAN | false | — |
| image_folder | STRING | — | |
| image_extension | STRING | *.png;*.jpg;*.jpeg;*.webp;*.bmp | — |
| use_video | BOOLEAN | false | — |
| video_folder | STRING | — | |
| video_extension | STRING | *.mp4 | — |
| use_text | BOOLEAN | false | — |
| text_folder | STRING | — | |
| text_extension | STRING | *.txt | — |
| text_unit_mode | COMBO | file | 2 options: file, line |
| skip_empty_lines | BOOLEAN | true | — |
| use_audio | BOOLEAN | false | — |
| audio_folder | STRING | — | |
| audio_extension | STRING | *.mp3;*.wav;*.flac;*.m4a;*.ogg;*.aac | — |
| item_countopt | INT | 0 | — |
| progressopt | FLOAT | 0.0000–1 | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| base_name | STRING | — |
| image_path | STRING | — |
| video_path | STRING | — |
| text_path | STRING | — |
| line_index | INT | — |
| audio_path | STRING | — |
| item_count | INT | — |