deleteDir-badger
A folder-delete button inside your workflow — read the warning before you wire it
- result
- e_info
Every file-touching workflow eventually leaves a mess. Video frame extraction dumps thousands of PNGs into a temp folder, batch runs accumulate intermediate crops, and before long your disk is the thing that needs cleaning, not your prompts. deleteDir-badger is a real delete button you can drop into the graph: give it a path and it recursively deletes that folder and everything inside it. Simple, genuinely useful for temp-dir housekeeping, and - I need to say this plainly - it deletes for real. Type carefully.
How it works
It's a plain recursive delete. The node walks the folder top to bottom, removes every file, then removes every now-empty subfolder, then the folder itself. It's marked as an output node so ComfyUI treats it as a graph endpoint (it sits at the end of your chain as a cleanup step), and it reports back two things:
- result - an INT:
1if the delete succeeded,0if it failed (or the path never existed). - e_info - a STRING with the reason. Note the author is Chinese-speaking and the messages are in Chinese:
"路径不存在"means "path doesn't exist","成功删除"means "deleted successfully". If something else went wrong, e_info carries the raw Python exception text.
You can read result as a success flag and e_info as your diagnostic - wire the string to a text display node if you want to see why a cleanup step failed.
Inputs
- start - a STRING. It does nothing except exist as a required input (the same "dummy trigger" pattern you'll see on
GarbageCollect-badgerin this pack). Wire any string into it, or chain it from the node that made the mess. - dir_path - the folder to delete. This is the input that matters, and the one to double-check.
Installing it
Part of ComfyUI_BadgerTools. Via ComfyUI Manager search "BadgerTools" and install, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/AbyssYuan0/ComfyUI_BadgerTools
Restart after installing. No models needed for this node. The usual pack caveat applies: the requirements list is heavy and gets imported at startup, so the first launch after install is slow even though deleting a folder needs nothing but Python's os module.
The warning that matters
This is a destructive node, full stop. It does not move the folder to a trash can; it os.removes files and os.rmdirs directories. A typo in dir_path, or a variable that resolves to the wrong path, is a genuine data-loss event. The one mild safeguard is that it only acts on absolute paths and only deletes what's at that exact path - it won't reach up and remove a parent - but that's a thin comfort. Practical rules:
- Only feed it paths your own workflow created (this pack's
VideoToFrame-badger/VideoCutFromDir-badgertemp dirs are the intended cleanup targets). - Never wire a user-input string into it without validating.
- Build the path programmatically with
mkdir-badgerorgetParentDir-badgerso you know exactly what you're aiming at.
Used that way, it's a tidy little self-cleaning workflow - your temp dirs get nuked at the end of the run and disk stays flat. The pack has no real community footprint, so you're on your own for policy; the policy is: respect the delete button. There's no confirmation dialog in ComfyUI, because there's no dialog in a graph. That's the deal.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| start | STRING | — | |
| dir_path | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| result | INT | — |
| e_info | STRING | — |