I'm just keeping things factual, I'm sorry if you took it as a negative comment. It is true that the OP wanted to remove (otherwise) empty folders.
So in my ~/Downloads/ folder, I do not want to leave all the folders there I download files for work daily, and they are numerous in number and usually large. I have a script which deletes files accessed over 60 days ago, and empty folders. I have thousands of folders that have had their contents removed, but the directory is still cluttered. Eventually you actually can run out of inodes on a disk, so it's fine to delete folders in this case.
This thread helped me figure out what I needed and it now works as I hoped.
Script for reference:
#~/Library/LaunchAgents/com.myname.reaper.plist calls this script
#using launchd to run 1x a day at 10:00
#`
#!/bin/sh
# Finds all files within ~/Cases/ whose "last accessed"
# dates are more than 120 days ago and moves them to the trash.
#
# Finds all files within ~/Downloads/ whose "last accessed"
# dates are more than 60 days ago and moves them to the trash.
date
echo $TIME
find ~/Documents/Cases/ -atime +120 -print
find ~/Documents/Cases/ -empty -print
find ~/Downloads/ -atime +60 -print
find ~/Downloads/ -empty -print
find ~/Downloads/ -type f -name ".DS_Store" -print
find ~/Documents/Cases/ -atime +120 -exec mv {} ~/.Trash/ \; ;
find ~/Documents/Cases/ -empty -exec mv {} ~/.Trash/ \; ;
find ~/Downloads/ -atime +60 -exec mv {} ~/.Trash/ \; ;
find ~/Downloads/ -type f -name ".DS_Store" -exec mv {} ~/.Trash/ \; ;
find ~/Downloads/ -empty -exec mv {} ~/.Trash/ \; ;
echo __________________________________________
echo $TIME
say -v Zarvox "reaper complete"