Nodes/ComfyUI-FolderBatch/FolderBatch Sync Queue
ComfyUI Node

FolderBatch Sync Queue

The node that keeps image + prompt + audio in lockstep through a whole batch

By aiai-r·Created 8 months ago·Updated about a month ago· 3
FolderBatch Sync Queue
    • base_name
    • image_path
    • video_path
    • text_path
    • line_index
    • audio_path
    • item_count
    common_folder
    sync_modeBy Name
    missing_policySkip
    start_at0
    auto_queuetrue
    sort_byName
    order_byA-Z
    use_imagefalse
    image_folder
    image_extension*.png;*.jpg;*.jpeg;*.webp;*.bmp
    use_videofalse
    video_folder
    video_extension*.mp4
    use_textfalse
    text_folder
    text_extension*.txt
    text_unit_modefile
    skip_empty_linestrue
    use_audiofalse
    audio_folder
    audio_extension*.mp3;*.wav;*.flac;*.m4a;*.ogg;*.aac
    item_count0
    progress0.000

    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.

    CategoryFolderBatch/Sync

    Inputs (23)

    NameTypeDefaultDescription
    common_folderSTRING
    sync_modeCOMBOBy Name2 options: By Name, By Order
    missing_policyCOMBOSkip3 options: Skip, Error, Empty
    start_atINT0
    auto_queueBOOLEANtrue
    sort_byCOMBOName3 options: Name, Date, Random
    order_byCOMBOA-Z2 options: A-Z, Z-A
    use_imageBOOLEANfalse
    image_folderSTRING
    image_extensionSTRING*.png;*.jpg;*.jpeg;*.webp;*.bmp
    use_videoBOOLEANfalse
    video_folderSTRING
    video_extensionSTRING*.mp4
    use_textBOOLEANfalse
    text_folderSTRING
    text_extensionSTRING*.txt
    text_unit_modeCOMBOfile2 options: file, line
    skip_empty_linesBOOLEANtrue
    use_audioBOOLEANfalse
    audio_folderSTRING
    audio_extensionSTRING*.mp3;*.wav;*.flac;*.m4a;*.ogg;*.aac
    item_countoptINT0
    progressoptFLOAT0.0000–1

    Outputs (7)

    NameTypeDescription
    base_nameSTRING
    image_pathSTRING
    video_pathSTRING
    text_pathSTRING
    line_indexINT
    audio_pathSTRING
    item_countINT