I would like to clean up some folders. So I want to delete all folders which are empty or only contain other folders...
First I tried
find . -type d -delete
but this lists the subfolders after the parents, so I would have to execute it multiple times.
So I tried using tac and pipes
find . -type d | tac | xargs rmdir
This one fails on whitespaces, etc, so I need a masking - now I am stuck...
-delete
action also implies-depth
i.e. directories containing only other directories become empty as the command executes from the bottom of the tree up. – steeldriver Nov 06 '15 at 11:10