π Delete File
The boring cleanup node that saves you a terabyte
- Deleted Path
Housekeeping inside the graph
Generating in ComfyUI leaves debris: the 400 throwaway previews from an afternoon of seed-hunting, the upscale iterations, the temp conversions. Delete File removes one file, given an absolute path, and passes that path along so you can log it.
That's the whole node, and it earns its keep in exactly one place - pipelines. π List Files gives you a list of filenames, π Array For Each walks them one per run, Delete File removes the one you're on. Thirty seconds of wiring saves you from opening a file manager and clicking through a folder that Windows Explorer takes forty seconds to thumbnail.
How it works, and what it won't tell you
Path stripped. If it's non-empty and the file exists, os.remove. If it doesn't exist - already gone, typo, wrong separator - nothing happens and no error is raised. The node returns the path either way.
So the failure mode is "silence". Which is fine for cleanup and terrible for anything else: if you're using Delete File as a "process then remove" step in a batch, a typo'd path means files that quietly never get deleted, and you find out when the disk fills. Check the returned path in a console print, or list the directory afterwards.
The second thing to know: this is a non-output node, so it only executes if something downstream consumes its Deleted Path. Wire the output nowhere and it's an inert box on the canvas - which will confuse you the first time (nothing got deleted!) and reassure you the second time (nothing got deleted).
Third, and this one matters on Windows: it takes a path, not a glob. C:\out\*.png deletes nothing, because no file is literally called that. Expansion is a job for π List Files with its filter field, plus the array nodes.
Inputs and output
File Path - a STRING, absolute, typed or wired. Given that a destructive action lives on the end of it, the same advice as Delete Directory applies: type it while you're testing, wire it only when the upstream is a list you've printed and read.
The pack's π Directory and π Path Join nodes are the intended way to build paths you can trust. Join your output folder with a filename from a list, normalise it, then delete - each step visible on the canvas rather than inside a string you can't inspect.
One output: Deleted Path (STRING). Its honest purpose is logging. π οΈ Print to Console is in the same pack for exactly this pairing.
The "keep the outputs, drop the temp" pattern
The genuinely useful version of this node is the one that runs per-image: Save Image writes your keeper to output/, and the workflow also produces intermediates you don't want. Point Delete File at the intermediate's path, and the run ends clean.
For "purge everything older than today", that's π List Files β π Array Filter on a pattern β π Array For Each β Delete File, driven across a batch of queued runs. It works. It is also the kind of automation that deserves a dry run with a print node first, because the moment the list is wrong you're deleting in bulk with no undo - file deletion doesn't go to any recycle bin, and ComfyUI has no transactional anything.
Install
Manager: Extensions β Node Pack β search "Honda Nodes" β Install β restart. Manual install:
cd ComfyUI/custom_nodes
git clone --depth 1 https://github.com/Avaray/honda-nodes.git
cd honda-nodes
python install.py # ComfyUI's python; portable Windows: ..\..\..\python_embeded\python.exe install.py
No binaries needed for this node, though the pack's installer fetches jq and ime for its JSON and metadata nodes. ComfyUI 0.38.0+ is required across the pack - it's V3-schema only, so an older build registers no nodes at all.
Common issues
File still there, no error. The path didn't resolve to an existing file. Print it. On Windows, watch for forward slashes mixed with backslashes, and for a path copy-pasted with quotes around it - quotes become part of the string and the file genuinely doesn't exist under that name.
"Permission denied" in the console. The file is open elsewhere - a viewer, a sync client, or one of ComfyUI's own loaders holding a handle. Unlike Delete Directory, this node doesn't suppress the exception, so you'll see it. Retry after closing whatever has it.
Deleted files come back on download. If your folder is inside a synced drive (OneDrive, Dropbox), the cloud copy is the original and will re-materialise. That's not ComfyUI's problem, but it looks exactly like a node that didn't run.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | Absolute path to the file to delete. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Deleted Path | STRING | β |