You have loads of empty directories to delete in Linux? There is a command for that!
How to list empty directories in Linux?
Go to the directory in which you want to clean empty directories, and start with the following command that allows to list them :
find . -type d -empty -print
You’ll get an output such as:
[email protected]:~# find . -type d -empty -print ./.config/htop ./test ./.cache/composer/files/phpoption/phpoption ./.cache/composer/files/ovh/ovh ./.cache/composer/files/phpdocumentor/phpdocumentor ./.cache/composer/files/phpdocumentor/reflection ./.cache/composer/files/phpdocumentor/fileset ./.cache/composer/files/phpdocumentor/graphviz
Now if that is fine with you , the same command with a slight variation:
find . -type d -empty -delete
And there you go you’ve recusirvely deleted empty folders
Tested on Debian Stretch (9)