From: Garance A Drosihn Date: 2002-01-24T14:52:17+09:00 Subject: Re: Minor thoughts on 'Find' module At 2:32 PM +0900 1/24/02, Garance A Drosihn wrote: >So, I think I want something like: > > Find.findx(sort=File::NO_SORT, > parent_first=true, > breadth_first=false, > *srcdirs ) { |aFileName, aFindStat| block } > >Other values for sort= would be File::DIR_FIRST File::DIR_LAST and >perhaps File::ALPHABETIC I forgot to explain the other parameters. "parent_first" means that the code-block will always be called with the parent directory before it is called with any descendents of that parent. If that value is false, then the code block will not be called with the parent until after it has been called for all descendents. "breadth_first" means that the code-block will be called for all entries in a given directory before it is called for any descendents of subdirectories of that directory. Given a setup where Find.find("somedir") processes filenames in the order of: somedir somedir/afile somedir/subdir somedir/subdir/s1file somedir/subdir/s2file somedir/dfile somedir/cfile somedir/otherdir somedir/otherdir/ofile somedir/efile Then Find.findx("somedir", sort=File::DIR_FIRST) would do them as: somedir somedir/subdir somedir/subdir/s1file somedir/subdir/s2file somedir/otherdir somedir/otherdir/ofile somedir/afile somedir/dfile somedir/cfile somedir/efile Then Find.findx("somedir", sort=File::DIR_LAST) would do them as: somedir somedir/afile somedir/dfile somedir/cfile somedir/efile somedir/subdir somedir/subdir/s1file somedir/subdir/s2file somedir/otherdir somedir/otherdir/ofile Then Find.findx("somedir", parent_first=false) would do them as: somedir somedir/afile somedir/subdir somedir/subdir/s1file somedir/subdir/s2file somedir/dfile somedir/cfile somedir/otherdir somedir/otherdir/ofile somedir/efile Then Find.findx("somedir", breadth_first=true) would do them as: somedir somedir/afile somedir/subdir somedir/dfile somedir/cfile somedir/otherdir somedir/efile somedir/subdir/s1file somedir/subdir/s2file somedir/otherdir/ofile -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu