Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2004-03-16 19:58:01


"Janusz Piwowarski" <jpiw_at_[hidden]> wrote in message
news:002601c40b5c$96b7c820$2900050a_at_januszpXP...
> > I just had a look at boost::filesystem, and it felt really good to use.
> > There is one common idiom that might be worth including: recursive
> > traversal.
> >
> > So I would like some like
> >
> > recursive_directory_iterator i( path( "foo" ) ) , end;
> > for( i.set_traversal_mode( files_only ); i != end; ++ i ) // print all
> file
> > names recursively, default could be both dirs and files
> > cout << i->leaf();
> >
> I like it; i suggest breadth_first_search | depth_first_search extra
> traversal modes.
>

   I like breadth_first_search and depth_first_search much more than
files_only.
  If you want to only look at files, you can do

 recursive_directory_iterator i( path( "foo" ), breadth_first_search ) ,
end;
for ( ; i != end; ++i) {
    if (is_directory(*i)) continue;
   ...
}

Joe Gottman
Joe Gottman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk