Ubuntu Server – Delete empty directories except parent directory

I needed a bash script to delete empty directories, excluding the parent directory. The following does this:

find /home/alex/target mindepth 1 -maxdepth 1 -type d -empty -print0 | xargs -0 rm -R

And the crontab that does this every few hours

0 */12 1-31/2 * * find /home/alex/target -mindepth 1 -maxdepth 1 -type d -empty -print0 | xargs -0 rm -R >/dev/null 2>&1