Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!ulysses!gsf From: gsf@ulysses.homer.nj.att.com (Glenn Fowler[drew]) Newsgroups: comp.unix.questions Subject: Re: find command Summary: -depth is mis-named Message-ID: <12446@ulysses.homer.nj.att.com> Date: 1 Dec 89 13:16:08 GMT References: <616@uncle.UUCP> <21544@adm.BRL.MIL> <4343@helios.ee.lbl.gov> Organization: AT&T Bell Laboratories, Murray Hill Lines: 29 In article <4343@helios.ee.lbl.gov>, envbvs@epb2.lbl.gov (Brian V. Smith) writes: > It seems as though the Ultrix and SunOs find ALWAYS use a *depth-first* > search and there is no option to do a *breadth-first* search. > > Anyone out there know if it is possible to do a breadth-first search with find > under Ultrix or SunOs? I presume BSD is the same. the -depth option is mis-named - BSD and ATT find always use depth-first-search by default find does a pre-order DFS - a directory is seen before its children -depth (when available) turns on a post-order DFS - a directory is seen after its children have been processed $ find . -print # pre-order . ./first-child ... ./last-child $find . -depth -print # post-order ./first-child ... ./last-child . just think of -depth as -post a breadth-first directory traversal would be resource intensive -- Glenn Fowler (201)-582-2195 AT&T Bell Laboratories, Murray Hill, NJ uucp: {att,decvax,ucbvax}!ulysses!gsf internet: gsf@ulysses.att.com