ComfyUI Node

Path Exists

A true/false gate so your workflow can skip work

By kale4eat·Created 2 years ago·Updated 2 years ago· 0
Path Exists
    • exist
    path

    Most of the path nodes in this pack are pure text tricks - they slice and join strings without ever looking at your disk. Path Exists is the odd one out: it actually checks. Give it a path and it answers one question - is this real? - with a true or false that you can branch on.

    That's more useful than it sounds. ComfyUI workflows are dumb linear graphs by default, but add a boolean and a conditional, and suddenly a workflow can decide things for itself: skip the upscale if the output already exists, only process a model file if it's actually downloaded, route differently depending on whether a reference image is present. Existence checks are the cheapest form of state a workflow can hold.

    How it works

    The node calls os.path.exists(path) and returns the boolean. Two things that matter:

    • It's true for both files and folders. exists doesn't care about the kind of thing at the path, just that something is there. If you need to distinguish "is it a file" from "is it a folder", that's the pack's Path Isfile and Path Isdir nodes.
    • False for anything missing - including an empty string, which means the default state of this node (empty path input) is False. That's usually fine, but know it's there.

    Inputs and outputs

    • path (STRING, default empty) - the path to check. Type it, or wire in a string from another node.
    • exist (BOOLEAN) - the result.

    The boolean output is the whole point, but ComfyUI has no built-in "show me this boolean" box, so you need a destination for it. The common move is wiring it into a Switch/If-style node (from packs like Impact or rgthree) to pick between two branches, or into a node that accepts a boolean input. If you just want to see the value for debugging, a Primitive node will display it.

    Installing it

    The whole pack is dependency-free - pure Python standard library, no requirements.txt, no pip, no model downloads. That makes it one of the least likely custom-node installs to break your setup, which in this ecosystem is genuinely worth something.

    cd ComfyUI/custom_nodes
    git clone https://github.com/kale4eat/ComfyUI-path-util
    

    Restart ComfyUI afterward. Or use ComfyUI Manager and search "path-util" - one click, same result.

    Common issues

    The classic confusion: Path Exists says False for a path you're sure is there. Nine times out of ten it's a relative-vs-absolute problem - the path is being resolved against ComfyUI's working directory (where you launched the server), not where you think it is. Run the path through Path Abspath first if you're uncertain, or check whether a ~ or environment variable got left unexpanded in the string.

    The other trap is treating exist as "the file is ready to use." It tells you something is at that path, not that it's readable, not that it's a file, not that it's the thing you expect. For "is it actually a usable file", Path Isfile is the sharper tool - chain it after this one when the distinction matters.

    Categorypath-util

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRING

    Outputs (1)

    NameTypeDescription
    existBOOLEAN