Deleting directories

william E Davidsen davidsen at antarctica.crd.GE.COM
Thu Jul 12 00:47:20 AEST 1990


In article <1990Jul10.130548.10216 at cbnewsj.att.com>, ecl at 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 at 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



More information about the Comp.unix.questions mailing list