find . * -depth -print0 | xargs -0 rmdirIt finds and removes all empty folders (including hidden ones) recursively.I only tried it on my home folder and a pendrive in Linux PC and it worked but I don't know if it is safe to run from / as rootI once nuked my OS by running some command off the internet (which I didn't understand) like that.
Is this command safe to run from / as root
find;root;directory structure
The man page for rmdir says:-Remove the DIRECTORY(ies), if they are empty.If you want to remove all empty directories then it will be safe.  The question you need to ask is:-Do you want to remove all empty directories?Some applications need a directory even if it's empty.  For example, journald can be configured so that it only logs to persistent storage if /var/log/journald exists.  If you run your command when that directory is empty then it will be deleted.  Afterwards journald will not log to persistent storage as it can't find the directory.  I believe Fedora is configured this way by default.Also, empty (unmounted) mount points could also be deleted by your command.  They should be reasonably easy to fix, but it could still catch you out.