Delete Files ๐
Glob-delete files from inside your workflow
- log
DeleteFiles is a small, slightly dangerous convenience: it deletes files off the disk of whatever machine is running ComfyUI, straight from a node in your graph. You hand it a path with a wildcard - X://path/to/dataset/*.txt - and it removes everything that matches. That's it. No trip to a file explorer, no separate terminal.
It comes from ComfyUI-MieNodes, a utility pack by MieMieeeee (a video creator who posts as ้ป้ปๅไธๅฉ on Bilibili and SweetValberry on YouTube). Most of the pack exists to make LoRA dataset prep less of a slog - captioning, renaming, converting, and yes, deleting the leftover junk between training runs. This is the broom.
Where it fits
Say you just batch-generated a pile of .txt caption files, decided the captions were garbage, and want to wipe them and start over. Or you converted a folder of images to .png and want to nuke the old .webp originals. Instead of alt-tabbing to your OS, you point DeleteFiles at the folder with the right glob and run the graph. The KB's dataset-prep notes will tell you dataset curation beats every training knob you can turn - and curation means a lot of small delete/rename/convert loops. This node is built for that loop.
How it works
There's no model, no network, nothing clever. Under the hood it's a Python glob-and-os.remove. The path input is the whole interface: give it a plain file path to delete one file, or a wildcard pattern (*.txt, *.webp, temp_*) to delete a matching set. The default value in the box, X://path/to/file_or_directory/*.txt, is a placeholder - swap in a real path before you run it, obviously.
The single output is log, a STRING that reports what it did (which files matched, how many went away). Wire that into a ShowAnything node if you want to actually read it, or ignore it. It's there mostly so you have a receipt.
The one input that saves you
mock(boolean, default off) - this is the input to care about. Flipmockon and the node does a dry run: it tells you in the log exactly what it would delete, without deleting anything. Given that the alternative is "permanently remove files based on a glob I typed in a hurry," you should basically always run once withmockon, read the log, confirm the list is what you expected, then flip it off and run for real. Treat it likerm's missing "are you sure" prompt.
Installing it
You install the whole pack, not the single node. Easiest path is ComfyUI Manager: open it, search ComfyUI-MieNodes (registry title ComfyUI_MieNodes), install, restart. By hand it's the usual:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
then restart ComfyUI. There's no multi-gig model download - these are plain Python utility nodes. After the restart the MieNodes show up under a sheep-emoji ๐ menu (the author's mascot; ๅฉ is the sound a sheep makes).
Common issues
The big one is conceptual: this deletes on the ComfyUI host, not on your laptop. If you're running ComfyUI locally that's the same thing. If you're on a rented or serverless GPU, the X:// Windows-style placeholder path won't exist over there, and paths resolve relative to the ComfyUI process's filesystem - so a delete either hits nothing or hits something you didn't picture. Test with mock on first, every time, and if you're not sure how a relative path resolves on the host, run it through GetAbsolutePath to see where it actually points.
The other gotcha is that a glob is only as careful as you are. *.txt in the wrong directory takes every text file, not just your captions. There's no recycle bin here. And because MieNodes is a niche solo project, your safety net is mock and a steady hand, not a forum thread full of people who hit the same landmine. If you specifically want extension-plus-prefix deletes with a bit more structure, its sibling BatchDeleteFiles is the safer, less freeform option.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| path | STRING | X://path/to/file_or_directory/*.txt | โ |
| mock | BOOLEAN | false | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| log | STRING | โ |