On 1/18/21 2:53 AM, L A Walsh wrote:
Except that 'find DIR -depth -type d -exec rmdir {} +'
is anything but simple and not something anyone outside of
a minority of *nix users would have a clue about how to create, whereas 'rmdir -r DIR' is both direct and simple and
more easily understandable

It's not that simple. For example, it's not clear whether rmdir -r should also remove directories containing only empty subdirectories, which is what you asked for. Perhaps some people would want that, perhaps they'd want to remove just empty leaf directories. Or perhaps they'd want rmdir to remove empty subdirectories only if it has permission to do so. Or maybe they'd want to also remove subdirectories whose directory entries are all hidden (start with '.'). Or there are lots of other possible things people could plausibly want.

This is what 'find' is for. If people needed to do something like "rmdir -r" every day then it'd be plausible to add it even though there's a simple substitute. But people don't, so let's stick with what we have.



Reply via email to