Path: utzoo!attcan!uunet!crdgw1!antarctica!davidsen From: davidsen@antarctica.crd.GE.COM (william E Davidsen) Newsgroups: comp.unix.questions Subject: Re: Deleting directories Message-ID: <9618@crdgw1.crd.ge.com> Date: 11 Jul 90 14:47:20 GMT References: <37481@ucbvax.BERKELEY.EDU> <1990Jul10.130548.10216@cbnewsj.att.com> Sender: news@crdgw1.crd.ge.com Reply-To: davidsen@crdos1.crd.ge.com Organization: GE Corporate R&D Center, Schenectady NY Lines: 22 In article <1990Jul10.130548.10216@cbnewsj.att.com>, ecl@cbnewsj.att.com (Evelyn C. Leeper) writes: |> I should say RTFM, but: |> find top-directory-name -depth -type d -exec rmdir {} \; |> |> The -depth goes postorder. |> The rmdir will fail on any non-empty directories. If you're on a machine with xargs it will go a LOT faster for big trees if you say: find top-dir -type d -depth -print | xargs rmdir The suggested solution will work perfectly, but will run rmdir for EVERY directory. xargs allows doing a bunch with each process. -- Bill Davidsen (davidsen@crdos1.crd.ge.com, uunet!crdgw1!crdos1!davidsen) GE Corp R&D Center, Schenectady NY Moderator of comp.binaries.ibm.pc and 386users mailing list "Stupidity, like virtue, is it's own reward" -me