|
From: | Paul Eggert |
Subject: | bug#45924: RFE: rmdir -r: recursively remove [empty] directories under the target. |
Date: | Mon, 18 Jan 2021 21:16:03 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 |
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 ofa minority of *nix users would have a clue about how to create, whereas 'rmdir -r DIR' is both direct and simple andmore 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.
[Prev in Thread] | Current Thread | [Next in Thread] |