Subject: Re: bug#45924: RFE: rmdir -r: recursively remove [empty] directories under the target.

From: Bernhard Voelker <[email-masked]>
Date: Mon, 18 Jan 2021 17:08:51 +0100

On 1/17/21 11:18 PM, Paul Eggert wrote:
> find DIR -depth -type d -exec rmdir {} +

find(1) can also find empty directories and delete them:

  $ find DIR -type d -empty -delete

FWIW: -delete implies -depth.

If one wants to see what empty directories have been found (and get deleted),
just put a -print in there:

  $ find DIR -type d -empty -print -delete

The above works with GNU find (as both -empty and -delete are GNU extensions).

Have a nice day,
Berny