Nodes/CoachBate/CoachBate File Exists
ComfyUI Node

CoachBate File Exists

Does this file exist?

By CoachBate·Created 2 months ago·Updated 7 days ago· 0
CoachBate File Exists
    • exists
    path

    Some nodes are infrastructure, not features. CoachBate File Exists is a one-job predicate: give it a path, get a boolean back. It's the kind of tiny utility you don't think about until you need it - then you need it constantly. In the pack's own production flow, something like this is what decides whether a start-frame image actually exists before you wire it into LTX conditioning, or whether a branch should run at all.

    How it works

    You feed it a path (STRING) and it returns True or False for whether that path points to an existing file. A few smart details under the hood: matching outer quotes are stripped, which matters because Windows paths with spaces are commonly passed around quoted; ~ and environment variables get expanded; and an empty path returns False rather than erroring.

    One gotcha to internalize: it checks os.path.isfile, not "does this path exist." A folder returns False. That's usually what you want in a pipeline ("do we have the conditioning image?"), but don't use it to test directories.

    Inputs and output

    • path - the file path to test. That's it; that's the whole input.
    • exists (BOOLEAN) - True if it's a real file, False otherwise.

    What you'd wire it into

    ComfyUI doesn't have a native if statement, but it has switches and conditionals that take a boolean. The classic pattern: a node produces a path (a Shot Loader outputting a start_image, a folder walker, a model path resolver), and you want to branch on whether that file is actually there. Feed exists into a switch or conditional node to pick between "condition on the image" and "skip the image." Or run it on a model path to decide between two LoRA loaders. It's a predicate - the interesting part is what you do with the answer.

    There's no forceInput magic here, but the path field accepts a wired input, so a path generated elsewhere in the graph flows straight in.

    Common issues

    • Folder returns False - expected; it's isfile, not isdir. Test files, not directories.
    • False on a valid file - the path resolves relative to wherever ComfyUI's server runs, not your browser. Use an absolute path, or remember remote/cloud setups see the server's filesystem, not yours.
    • Quoted paths - matching outer quotes are fine (stripped automatically); an unpaired quote isn't.

    Installation

    Install via ComfyUI Manager (search "CoachBate") or:

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

    Restart ComfyUI; it appears under CoachBate → Utils in Add Node. No dependencies, no downloads - it's a handful of lines of Python. Alpha-stage pack, but there's very little here that can break.

    CategoryCoachBate/Utils

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRINGFile path to test. Matching outer quotes are ignored.

    Outputs (1)

    NameTypeDescription
    existsBOOLEAN