Nodes/OmniNodes/Folder Watcher πŸ‘οΈ
ComfyUI Node

Folder Watcher πŸ‘οΈ

Process the next file, every run

By TensorVizionΒ·Created 3 months agoΒ·Updated about 8 hours agoΒ· 0
Folder Watcher πŸ‘οΈ
    • next_file_path
    • next_file_name
    • remaining_count
    • total_count
    • summary
    β—„folder_pathβ–Ί
    β—„modeβ–Ύβ–Ί
    β—„extensionspng,jpg,jpeg,webpβ–Ί
    β—„manifest_pathβ–Ί
    β—„mark_processed_immediatelytrueβ–Ί
    β—„mark_filenameβ–Ί

    Drop files into a folder, run your workflow, pick up the next unprocessed one each time. That's Folder Watcher, and it's the cheapest queue system in ComfyUI - no database, no job server, just a folder plus a small JSON manifest that remembers what's been handled. It turns a ComfyUI install into a simple batch processor for "this folder keeps getting new images and I want each queue run to handle one of them."

    How it works: point folder_path at a directory, and the node scans it for files matching extensions (comma-separated, png,jpg,jpeg,webp by default), sorted alphabetically for a stable order. It compares against a manifest - a JSON file listing processed filenames - and returns the first file not in it. The manifest lives at manifest_path if you set one, otherwise .tensorvizion_processed.json inside the folder itself. If nothing's left, it tells you.

    The two modes are where the design gets interesting:

    • scan_and_return - find and return the next unprocessed file. If mark_processed_immediately is True (default), it's added to the manifest the moment it's returned.
    • mark_only - don't scan at all; just record a specific filename (mark_filename) as processed.

    That second mode exists so you can do the correct thing instead of the convenient thing. If downstream processing can fail - and in ComfyUI it absolutely can - marking a file processed the instant you read it means a failure silently skips it forever. The robust pattern: run with mark_processed_immediately=False, do your actual processing, and only then hit a second Folder Watcher call in mark_only mode to mark that file done after it succeeded. The README calls this pattern out explicitly, and it's the difference between a batch processor that's trustworthy and one that eats files.

    Outputs: next_file_path, next_file_name, remaining_count, total_count, and a summary. Wire the path into a Load Image node (or a path-based loader) and you have a loop: each queue run grabs the next file, processes it, marks it, done.

    It's worth noting what it isn't. The name says "watcher" but it doesn't watch - no background thread, no filesystem events, no auto-trigger. Each run just looks at the folder state at that moment. That's a feature (simple, predictable, no state to lose) but if you want "new file appears β†’ workflow starts automatically," this isn't that node. Also, the folder path is just a string; there's no ComfyUI-managed browser, so give it an absolute path.

    The one real dependency note is a pleasant one: unlike the rest of the pack's Web API category, this node uses only the Python standard library - no requests, no extra install. It's the safest node in that category from a "what did I just install" perspective.

    Install

    Part of OmniNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TensorVizion/OmniNodes
    

    Restart ComfyUI, or install "OmniNodes" via ComfyUI Manager. No extra dependencies.

    Troubleshooting

    • "Folder not found" - the path isn't visible from ComfyUI's process. Use an absolute path.
    • Files skipped without processing - mark_processed_immediately is True and something downstream failed. Switch to the scan + mark_only pattern above.
    • Order seems wrong - files are sorted alphabetically, not by modification time. Name files with zero-padded numbers (frame_001, frame_002) for a meaningful order.
    CategoryTensorVizion/Web API

    Inputs (6)

    NameTypeDefaultDescription
    folder_pathSTRINGβ€”
    modeCOMBO2 options: scan_and_return, mark_only
    extensionsSTRINGpng,jpg,jpeg,webpβ€”
    manifest_pathSTRINGβ€”
    mark_processed_immediatelyBOOLEANtrueβ€”
    mark_filenameoptSTRINGβ€”

    Outputs (5)

    NameTypeDescription
    next_file_pathSTRINGβ€”
    next_file_nameSTRINGβ€”
    remaining_countINTβ€”
    total_countINTβ€”
    summarySTRINGβ€”