清理文件🐠meeeyo.com
Clean out your ComfyUI output folder from inside a workflow — carefully
- any
- result
Every heavy ComfyUI user knows the pain: your output folder is a landfill of 3,000 PNGs and you can't find the one you just made. FileDeleteNode (清理文件 - "clean up files") is the pack's answer - a node that deletes files from your output directory on demand, as part of the workflow, with a status string instead of a silent nuke. It's useful, and it's also the kind of node you should think twice before wiring into a loop. Let's be adults about it.
How it works
One real input: items_to_delete, a multiline STRING. Each line is one item relative to your ComfyUI output directory (ComfyUI/output/). So a line 33.png deletes output/33.png, cs1/01.png deletes output/cs1/01.png, and a bare cs1 deletes the whole directory output/cs1/ recursively. Yes - a directory name on a line removes everything inside it. That's intentional, and it's the sharpest edge of this node.
Two safety rails exist, and they're worth knowing:
- Everything is confined to the output directory. The node checks that each target resolves inside
output/and refuses anything that escapes it (no../sneaking out to your system). [DeleteAll]as a line wipes the entire output directory - every file and subfolder. This is the "reset the landfill" option, and it does what it says.
Missing items don't kill the run: they're collected as per-item error messages, and the output is a STRING status like 执行成功: 所有指定项已从output目录删除 ("success: all items deleted from output dir") or 部分执行失败: ... listing what couldn't be deleted. There's an unused optional any input port (same as the other file nodes in this pack) - ignore it.
Why you'd reach for it
Housekeeping, batch-style. The natural pairing is FileListAndSuffix from the same pack: list the folder, run a filter, and clean up files that failed or got superseded. In a long batch session you can queue a cleanup between runs without leaving ComfyUI.
Install
Part of ComfyUI_StringOps:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
Restart. Or ComfyUI Manager → "ComfyUI_StringOps". No models. Chinese UI (清理文件) with the 🐠meeeyo.com branding.
Common issues
Let's be direct: this node deletes things permanently - no trash, no undo. shutil.rmtree on a directory is irreversible. Three habits keep you safe: (1) never run it automatically off a live input without a guard, because if it sits in a workflow that re-executes on every queue, it can re-delete; (2) remember it only reaches the output directory - files elsewhere are out of scope, which is a safety feature, not a limitation; (3) the [DeleteAll] line is a real footgun if a shared workflow has it and you didn't notice - check before you queue. Also note the paths are literal: output/33.png won't match 33.png - keep the lines relative to the output dir itself.
Handy, powerful, and honestly a little scary. Use it for deliberate cleanup, not for automatic pipeline hygiene, and it's a great addition to the pack's file toolkit.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| items_to_delete | STRING | 33.png cs1/01.png cs1 | — |
| anyopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | STRING | — |