220411-2155.mp4_800px_HQ_30fps_220411.gif



1. Intro

This is a fun one. I found a utility, not long ago, to delete all the empty folders and subfolders within a directory. I think it's super useful to clean up those complicated project folder structures that end up with more empty folders than used ones. Other times, it's just overall cleanup when necessary.

The tool in question is aptly called Delempty, and was created by *Skrommel* with AutoHotKey. With it you can open certain folders and it will scan the items inside, letting you pick those with 0 files or 0 bytes. This alone is a great (and safe!) way to get rid of those pesky files. If you just want the tool this form, get it here:

DelEmpty

HOWEVER, we can s p i c e things up a bit and make this tool automatic, and also give it a powerful shortcut that will let us right click anywhere and use the tool in the current folder and subfolders.

<aside> ❗ Just as a warning, this tool deals with deleting empty folders. Not only that, but it can do so automatically and with no Undo button. I use it all the time and it has never caused any issues, but since I'm introducing it here, I feel obligated to warn you and encourage you to always back up your work in case something goes wrong.

</aside>

2. How to ‘install’ the utility

a. Automatically deleting all empty folders

What we need to do now, is take this utility and configure it to do what we want, automatically.

For this, we can use a .bat file, and point it to the Delempty.exe tool, along with some indications on what we want it to do.