GNU bug report logs -
#45924
RFE: rmdir -r: recursively remove [empty] directories under the target.
Previous Next
Full log
View this message in rfc822 format
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.
This bug report was last modified 3 years and 116 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.