Nodes/ComfyUI-ArchiGraph/Filepath Generator Maker πŸ¦β€πŸ”₯
ComfyUI Node

Filepath Generator Maker πŸ¦β€πŸ”₯

Feed a whole folder into a loop, one file at a time

By vincentfsΒ·Created 2 years agoΒ·Updated 9 months agoΒ· 3
Filepath Generator Maker πŸ¦β€πŸ”₯
    • enumerator
    β—„target_folder%USERPROFILE%β–Ί
    β—„file_extensionβ–Ί

    The most common batch-processing ask in ComfyUI is "run this pipeline on every image in this folder." Doing that by hand means dragging files in one at a time. This node exists so you don't have to: it builds a generator over every matching file in a folder, and its sibling node Iterate Generator walks that generator one item per graph pass.

    The inputs

    • target_folder (default %USERPROFILE%): which folder to enumerate. The default is a Windows environment variable, which tells you the author's primary audience - on Linux or macOS that literal string won't resolve to anything useful, so type a real path. Subfolders are not included (the tooltip is explicit).
    • file_extension: filter by extension. Leave it empty and it grabs png, jpg, and jpeg only. Supply e.g. npy or webp and it restricts to that. The leading dot is optional - the node strips it.

    How it works

    It returns a *-typed enumerator - a Python generator factory, not a list. That's the deliberate design: the actual files get walked lazily, so a folder of thousands of images doesn't get loaded into memory or force ComfyUI to render a giant list widget. The generator only starts producing when the Iterate Generator node calls it.

    If the folder doesn't exist, it returns None and logs a message instead of crashing - which is friendly, but it means you'll silently get nothing downstream. Check your path.

    The workflow it's built for

    The canonical chain: Filepath Generator Maker β†’ Iterate Generator β†’ (feed the item - a file path - into a Load Image or Load Nparray node) β†’ process β†’ save with a name derived from the loop's index. The iteration nodes re-run the whole graph per file, so your whole pipeline gets applied to every image in the folder automatically. This is the folder-batch backbone of the pack.

    Install

    ComfyUI Manager β†’ search ComfyUI-ArchiGraph, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vincentfs/ComfyUI-ArchiGraph
    

    Restart and run the pack's install script once. This node is pure Python (pathlib) - no OpenCV involved.

    Gotchas

    • The %USERPROFILE% default is Windows-specific. On Linux/macOS, replace it with an absolute path before relying on it.
    • Recursion is a gray area: the tooltip says subfolders aren't included, but the implementation actually walks subdirectories. Don't build a workflow that depends on recursion - treat the tooltip as the contract and keep your target folder flat.
    • It's lazy by design. If you plug the enumerator into something that isn't the iterate node, you'll get a generator object, not file paths - the pairing is the feature.

    Folder batch processing in ComfyUI is usually a mess of manual file management. This node plus Iterate Generator is the pack's tidy answer to it.

    CategoryπŸ¦β€πŸ”₯ ArchiGraph/πŸ› οΈ Utils

    Inputs (2)

    NameTypeDefaultDescription
    target_folderSTRING%USERPROFILE%Target folder to enumerate files from. Subfolders are not included.
    file_extensionSTRINGFile extension to filter by. If empty, all 'png/jpg/jpeg' are included.

    Outputs (1)

    NameTypeDescription
    enumerator*β€”