Empty Folder Cleaner (Creepybits)
Housekeeping With a Safety Switch
- status
- folder_count
Every few months your output folder ends up as a skeleton - dozens of empty directories left behind by failed runs, moved files, and interrupted sorting jobs. Empty Folder Cleaner is the pack's janitor: it recursively scans a folder, finds every empty directory, and deletes them. And because deleting folders is the kind of operation you never want to do by accident, it's dry-run by default. Nothing gets removed until you explicitly tell it to.
The two inputs
target_folder- the root directory to scan. Note the default is a Windows-style placeholder (C:\path\to\output_folder) - you must set this to a real path on your machine.execute_cleanup(bool, default false) - the safety switch. False means "report only." True means "actually delete."
Outputs are status (a summary string) and folder_count (an INT telling you how many empty folders were found or removed).
How it works
Under the hood it walks the tree bottom-up (os.walk with topdown=False) - the important detail, because it means nested empty folders get handled correctly. When it walks up and finds a folder that was empty, it's already been deleted as part of a deeper pass, and the now-empty parent gets caught on the way up. Run it once and the whole skeleton collapses.
The dry-run logic is what makes it safe to trust: with execute_cleanup false, it counts and reports every empty folder and prints a "Preview: Found empty folder" line for each - nothing is touched. Flip the switch to true and it deletes them, printing each removal as it goes. The status string tells you which mode ran and how many folders were affected.
The gotchas
- The placeholder path. The default input is a literal
C:\path\to\output_folder. Run it without changing that and you'll get "The directory ... was not found." and a 0 count. Set your real folder first - this is the #1 "why is it not working" moment with this node. - It only deletes empty folders. Anything containing a file - or a subfolder containing a file - is left alone. If you're expecting it to prune folders with stray files, it won't; pair it with the pack's File Sorter or do the file cleanup first.
- Read-only/permissions. On Windows especially, a folder that's locked or read-only will print an "Error deleting" line and skip it. The scan continues; you just won't get a 100% clean sweep.
- Dry-run is your friend. The design intends "preview first, commit second." Getting into the habit of running once with
execute_cleanupfalse and reading the count before flipping it saves you from a badtarget_folderpointing at the wrong tree.
Installing it
It's part of the Creepybits pack, installed all at once:
cd ComfyUI/custom_nodes
git clone https://github.com/Creepybits/ComfyUI-Creepy_nodes.git
Restart ComfyUI, or find "Creepy" in ComfyUI Manager. No model downloads, no heavy dependencies - this is a pure file-system utility, so it works even on machines where you skipped the pack's Gemini-related requirements. It's not a node you build a workflow around, but it's the one you drop in at the end of a big project to tidy up - and the dry-run default means the mess is on you, not on it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| target_folder | STRING | C:\path\to\output_folder | — |
| execute_cleanup | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| status | STRING | — |
| folder_count | INT | — |