Windows and applications create many blank folders on your hard drive in time. And they stick even after you uninstall the software. To solve this issue of ghost folders, I created a simple python script to delete all empty folders in any given drive or folder path. Here is the code;


For this script to work, of course you need python to be installed on your computer.

Usage of the script is very simple:

  1. Open up a terminal/command prompt and navigate to the folder containing script.
  2. Type E:\Directory\Name\ToBe\Cleared
  3. Change E:\Directory\Name\ToBe\Cleared to any folder you want to clear.
  4. Depending on hard drive speed and levels of directories, this script may take some time to complete.

Hope you found it useful. Enjoy!