Path Isfile
The existence check that refuses directories
- isfile
Path Exists tells you something is at a path. Path Isfile tells you it's a file, specifically - not a directory, not a symlink to a directory, not just "not nothing." When your workflow's decision hinges on "is this checkpoint actually downloaded" or "does this image actually exist as a file," this is the node that gives you a clean boolean instead of a surprise later.
In practice this is the sharper sibling of Path Exists for most real workflow checks, because most of the things you gate on - models, LoRAs, reference images - are files. Exists would be true for a folder that shares the name; Isfile won't.
How it works
It's a straight call to os.path.isfile(path), returned as a boolean. The behavior:
trueonly when the path exists and is a regular file.falsefor directories, missing paths, and empty strings.- Symlinks to files count as files -
isfilefollows them.
Like the other checks in this pack, it's resolved against ComfyUI's working directory for relative paths, so a relative string means "relative to where you launched the server," not relative to the workflow.
Inputs and outputs
- path (STRING, default empty) - the path to test.
- isfile (BOOLEAN) - the answer.
The boolean output plugs into any Switch/If-style node to branch the graph, or into any node that takes a boolean input. The classic pattern: before running a heavy step that consumes a file, check isfile on the path you're about to load and skip straight to a fallback branch if it comes back false - cheaper than a failed load deep in the graph.
Installing it
Same zero-dependency install as the whole pack - pure Python standard library, no requirements.txt, no model downloads, nothing that can conflict with your other nodes.
cd ComfyUI/custom_nodes
git clone https://github.com/kale4eat/ComfyUI-path-util
Then restart ComfyUI. Manager users: search "path-util" in Custom Nodes Manager and hit install.
Common issues
The recurring gotcha across all three boolean nodes: a relative path that resolves against the wrong directory. isfile returning false for a file you can see usually means the path is relative to ComfyUI's launch directory, not the file's actual location. Run it through Path Abspath first if you're unsure.
The subtler trap is expecting isfile to validate that the file is loadable - it only confirms it's a regular file on disk. A truncated download or a corrupted file still passes isfile and fails later in the loader. Treat this as a cheap first gate, not a guarantee of a working file.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| path | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| isfile | BOOLEAN | — |