del file
Check whether a file exists, and optionally delete it — carefully
- Signal
- Signal
- exists?
- is_file?
del_file does one small, sharp-edged thing: it checks whether a file or folder exists at a given path, and - only if you explicitly flip a switch - deletes it. The README's own warning is blunt: "if Delete is enabled, delete it after detection... use with caution." That's not boilerplate. This node calls a real filesystem delete, not a move-to-trash - there's no undo.
It's part of ComfyUI-WJNodes, a large personal utility pack (807502278's description: "a simple node package that I use myself") that also does image cropping, video slicing, and color filtering. Checking around, there's essentially no public discussion of this pack anywhere - it's not a widely-adopted community tool, it's someone's own toolbox shared on GitHub. Worth knowing before you wire a destructive node into a production graph based on it.
How it works
You give it a Signal and a FilePath. It checks the path and reports back whether something exists there and whether that something is a file (as opposed to a directory). If Delete is turned on, it deletes whatever it found immediately after that check - same node, same execution, no confirmation step. The Signal input and output exist purely for ordering: ComfyUI's graph doesn't otherwise guarantee that a file-operation node runs before or after some other side-effecting node, so you route a signal through it to force sequencing (e.g., "don't delete this until after the save node has finished writing the next one").
The inputs and outputs that matter
FilePath- the path to check (and possibly delete). Get this exactly right; there's no confirmation dialog standing between a typo and a deleted file.Delete(default off) - the safety switch. Left at its default, this node is purely a read-only existence check. You have to deliberately turn this on to make it destructive, which is the right default for a node that can permanently remove files.Signal(*type, in and out) - a pass-through used to chain execution order with other nodes, not data you'd normally look at directly.
Outputs: Signal (passed through unchanged), exists? (BOOLEAN), and is_file? (BOOLEAN) - the latter distinguishing a file from a directory at that path.
How to install it
Through ComfyUI Manager: search "ComfyUI-WJNodes," install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
Restart ComfyUI. Nothing extra to download - this is filesystem code, not a model. The README's optional pip install -r requirements.txt is unlikely to matter for a node this simple.
Common issues & troubleshooting
A file got deleted that you didn't mean to delete. Almost always means Delete was left on from a previous test run and FilePath pointed somewhere you didn't check carefully. Since Delete defaults to off, treat any graph where it's on as something to double-check every single run, not something to set once and forget.
exists? returns false for a file you know is there. Check for relative-vs-absolute path mistakes - this node checks the exact string you give it against the filesystem the ComfyUI process is running on, which matters a lot if you're on a remote or containerized instance where "the file" might live somewhere other than where you expect.
Write permission errors on delete. The README notes deletion "requires write permission" - if the process ComfyUI is running under doesn't own the file or the containing directory, the delete will fail rather than silently succeed.
Nowhere to check if something feels off. Because this pack has essentially no public community footprint, you won't find a thread describing your exact edge case. Test destructive settings on throwaway files first, not the ones you care about.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| Signal | * | — | |
| FilePath | STRING | — | |
| Delete | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| Signal | * | — |
| exists? | BOOLEAN | — |
| is_file? | BOOLEAN | — |