Nodes/ComfyUI_MieNodes/File Exists ๐Ÿ‘
ComfyUI Node

File Exists ๐Ÿ‘

A boolean check for skip-if-cached workflows

By MieMieeeeeยทCreated 2 years agoยทUpdated 28 days agoยท 225
File Exists ๐Ÿ‘
    • exists
    โ—„file_pathoutput/cache/abc.mp4โ–บ

    Does this file exist? Yes or no. That's the entire node - and it's more useful than it sounds. FileExists takes a path and returns a boolean, which is exactly the primitive you need to build caching and skip logic into a ComfyUI graph: check whether an output already exists, and branch on the answer so you don't regenerate something you already have.

    Part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, in the Common group.

    Why you'd use it

    ComfyUI has its own execution caching, but it doesn't know about your files. If you're running an expensive step - a long video render, a big generation - and you've already produced the output once, you'd like to skip it on the next run. To do that you need a way to ask "did I already make this?" and act on it. FileExists is that question, expressed as a wire.

    The default value in the node is telling: output/cache/abc.mp4. This is built for caching. The intended pattern is to compute a deterministic filename for a piece of work - often a hash-based name, which is what the pack's ImageHash and StringHash nodes exist to produce - then check whether that file is already on disk before spending the compute to create it. If exists is true, route around the heavy node; if false, run it. It turns a filename convention into a genuine skip-if-cached switch.

    The inputs and outputs that matter

    One required input:

    • file_path - the path to check (default output/cache/abc.mp4). Feed it a computed cache path or a literal one.

    One output:

    • exists (BOOLEAN) - true if the file is there, false if not.

    Wire exists into whatever consumes a boolean in your branching setup - a conditional/switch node, or a trigger_signal on another MieNodes node - to decide whether the expensive branch runs.

    Installing it

    ComfyUI Manager โ†’ search ComfyUI-MieNodes โ†’ install โ†’ restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
    

    then restart. No model download. Nodes appear under the ๐Ÿ‘ MieNodes menu.

    Common issues

    It only reports; it doesn't branch. FileExists gives you a boolean and nothing more. The actual "skip this" behavior comes from whatever you wire the exists output into - a switch, a conditional, a gate node. This is the sensor, not the valve.

    Relative vs absolute paths. The default is a relative path (output/cache/abc.mp4), which resolves against ComfyUI's working directory. If your files live elsewhere, use an absolute path so there's no ambiguity about where it's looking.

    Caching needs a stable filename. The whole pattern falls apart if the filename isn't deterministic - check-then-generate only helps when the same input produces the same path every time. That's why it's usually paired with a hashing node (ImageHash / StringHash) that turns your inputs into a stable cache key. A random or timestamped name will never be found.

    Serverless caveat. On a cloud/serverless ComfyUI the filesystem is often ephemeral, so a file "cached" on one run may be gone on the next. This caching trick works best on a local install with a persistent output folder.

    Category๐Ÿ‘ MieNodes/๐Ÿ‘ Common

    Inputs (1)

    NameTypeDefaultDescription
    file_pathSTRINGoutput/cache/abc.mp4โ€”

    Outputs (1)

    NameTypeDescription
    existsBOOLEANโ€”