bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10802: rmdir -p behaviour


From: Jim Meyering
Subject: bug#10802: rmdir -p behaviour
Date: Tue, 14 Feb 2012 23:06:34 +0100

Paul Ruane wrote:

> Apologies, I did not copy the mailing list on part of the discussion.
>
> On 14 February 2012 20:48, Jim Meyering <address@hidden> wrote:
>>>>I should have asked up front,
>>>>Have you considered the --ignore-fail-on-non-empty option?
>
>>>Um, no! That's perfect. Not sure why I didn't see that before: either
> my eyes skipped it or I disregarded it but it's there, as plain as
> day.
>>> Actually it's not quite perfect I have to do 'rmdir -p
>>> --ignore-fail-on-non-empty a/b a/c a/d a/e' rather than my proposed
>>> 'rmdir -d a' but it'll do at a pinch.
>
>> or this:
>>  rmdir -p --ig a/[bcde]
>
> This does solve the problem but means I have to list all of the leaf
> nodes of the branch I wish to remove. I still can't help but think
> there should be a --descendents option to allow a branch (of empty
> directories) to be removed more simply. The above would then simply
> become:
>
> $ rmdir -d a
>
> Even if directories b, c, d and e have children themselves.

I suggest you use find.
This does what you want, at least with GNU find:

  find a -depth -type d -empty -delete





reply via email to

[Prev in Thread] Current Thread [Next in Thread]