find . -type d -empty -delete
39
Recursively remove all empty directories
Alternatives
There are 2 alternatives - vote for the best!
find . -empty -type d -exec rmdir {} +
14
A quick way to find and delete empty dirs, it starts in the current working directory.
If you do find . -empty -type d you will see what could be removed, or to a test run.
If you do find . -empty -type d you will see what could be removed, or to a test run.
find . -type d -empty -delete
find . -type d -empty -delete
find . -depth -type d -empty -exec rmdir -v {} +
6
this will show the names of the deleted directories, and will delete directories that only no files, only empty directories.
find . -type d -empty -delete
find . -type d -empty -exec rm -rf {} \;