On Thu, Apr 07, 2005 at 08:45:58PM +0100, Philip Rowlands wrote:
> rmdir can still be useful as a less-dangerous alternative to rm -r;
> rmdir * will only wipe empty directories, although I was overjoyed when
> I found this worked:
>
> $ find dirname -depth -type d -empty -exec rmdir -v -- '{}' ';'
Recent versions of findutils also allow you to do it like this:
$ find dirname -type d -delete # -delete implies -depth
or like this:
$ find dirname -depth -type d -empty -execdir rmdir '{}' '+'
(GNU find -execdir subsitutes ./filename for {} here, so you get
"rmdir ./-rf" rather than "rmdir -rf").
Regards,
James.