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



Reply via email to