Nodes/ComfyUI Easy Use/easy isFileExist
ComfyUI Node Runs on cloud

easy isFileExist

Check whether a file is already there before doing work

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
easy isFileExist
    • boolean
    file_path
    file_name
    file_extension

    easy isFileExist checks whether a file exists on disk and outputs true or false. Sounds mundane, and it is - but it's the missing piece for building workflows that don't redo work they've already done. Paired with the pack's logic nodes, it lets you say "if this output already exists, skip generating it" - which is exactly what you want in a batch job or a loop that might get interrupted and restarted.

    This is the kind of node you don't know you need until you're running a big automated sweep and realize you're regenerating hundreds of images you already made. A file-existence check plus a gate turns that into a resumable job.

    How it works

    You give it a path, a filename, and an extension, and it looks on disk for that file, returning a boolean. The three fields are split so you can build the path from pieces - a base directory that stays constant, a filename that varies per iteration, and the extension separately - which is convenient when the filename is coming from a counter or a prompt-derived string in a loop. The output is just true/false; the decision is made by whatever reads it.

    The inputs and output

    • file_path - the directory (or path portion) to look in.
    • file_name - the file's name.
    • file_extension - the extension, e.g. png.
    • Output: boolean - true if the file is there, false if not.

    The natural downstream is a gate. Wire the boolean into easy blocker or an easy ifElse so that "file exists" routes to skip and "file missing" routes to generate.

    How to install it

    Via ComfyUI Manager: search "ComfyUI Easy Use", install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yolain/ComfyUI-Easy-Use
    

    Then install.bat / pip install -r requirements.txt, restart. Preinstalled on comfy.icu.

    Common issues

    Path assembly is where this goes wrong. The three separate fields are flexible but they're also three chances to get a slash or a dot in the wrong place - if the check always returns false when you know the file's there, print or double-check the exact path the node is building from file_path + file_name + file_extension. Relative-versus-absolute paths matter too: a relative path resolves against wherever ComfyUI is running from, which may not be where you think.

    The other thing to keep in mind is that existence is a point-in-time check. It tells you the file was there at the moment the node ran, nothing more. If you're using it to wait on a file that another process is still writing, existence doesn't mean finished writing - the file can exist while it's half-written. For a true "wait until ready" you'd combine it with retries or a delay. As a "have I already produced this output" check in a resumable batch, though, it's exactly right, and it's the piece that makes skip-if-done workflows possible.

    CategoryEasyUse/Logic

    Inputs (3)

    NameTypeDefaultDescription
    file_pathSTRING
    file_nameSTRING
    file_extensionSTRING

    Outputs (1)

    NameTypeDescription
    booleanBOOLEAN