ComfyUI Node

Does File Exist (Soze)

Skip regenerating what's already on disk

By SozeInc·Created 2 years ago·Updated 5 days ago· 10
Does File Exist (Soze)
    • BOOLEAN
    filepath

    Exactly what it sounds like - os.path.exists() wrapped as a ComfyUI node. Feed it a path, get a boolean back. It's a small node, but it's the kind of thing that saves real time and compute once you wire it in front of an expensive step: check whether an output already exists before regenerating it.

    It's a natural fit for anything that's re-run repeatedly over the same input set - a CSV-driven batch you're resuming after an interruption, a big checkpoint-comparison sweep you don't want to redo from row zero, a folder sync where half the files are already downloaded. Rather than tracking progress separately, you let the filesystem itself be the source of truth: if the output's there, skip it; if it isn't, generate it.

    How it works

    No mystery here - it checks whether the given path resolves to a real file on disk at the moment the node runs, and outputs true or false accordingly.

    The inputs and outputs that matter

    • filepath (STRING, required) - the path to check.
    • Output: a single BOOLEAN.

    That's the entire node. The value comes from what you do with the boolean downstream - feed it into a switch, gate, or If node to skip work conditionally.

    How to install it

    Via ComfyUI Manager: search "Quality of Life Nodes for ComfyUI", install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SozeInc/ComfyUI_Soze.git
    pip install -r ComfyUI_Soze/requirements.txt
    

    No API keys, no models, no dependencies beyond the base pack install - this one's pure Python.

    Common issues & troubleshooting

    Relative paths don't behave the way you expect. The node doesn't document a fixed base directory for a relative filepath (unlike, say, Download URL in this same pack, which is explicit that its path is relative to ComfyUI's output dir). If you're getting an unexpected false for a file you know exists, try an absolute path first to rule out a working-directory mismatch, then narrow down from there.

    You need this to gate an entire branch of a workflow, not just skip one node. ComfyUI doesn't have true conditional execution out of the box - pair this with whatever switch/gate nodes you've already got (this pack itself doesn't ship one), since Does File Exist only produces the boolean, it doesn't stop execution by itself.

    Race conditions in a fast batch loop. If another process (or an earlier step in the same batch) is still writing the file when this node checks, you can get a false for a file that exists a moment later. Not a bug in the node - just worth knowing if you're checking for output that's being produced concurrently.

    A zero-byte or partially-written file reads as "exists." A plain existence check doesn't know the difference between a complete file and one that crashed mid-write. If you're resuming an interrupted batch and worried about half-written outputs, this node alone won't catch that - you'd need a size or content check on top of it, which isn't something this node provides.

    CategorySoze Nodes

    Inputs (1)

    NameTypeDefaultDescription
    filepathSTRING

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN