Boost logo

Boost Users :

From: John Femiani (JOHN.FEMIANI_at_[hidden])
Date: 2008-05-14 13:13:47


> >> Hello all
> >> i like to get all folder and files names under giving
> folder , what
> >> will be the optimized way ( if any ) that boost can offer can you
> >> point me to example code thanks
> >
> > I do not know if it is optimized but it is portable. You
> can use the
> > BOOST::Filesystem library/interface.
> >
> > http://www.boost.org/doc/libs/1_35_0/libs/filesystem/doc/index.htm
> >
>
> iknow , i just need code sample to do it in the best way
>

recursive_directory_iterator

Heres a snippet:

        for( fs::recursive_directory_iterator it(folder)
           ; it != fs::recursive_directory_iterator()
           ; ++it)
        {
            if (boost::iequals(fs::extension(it->path()), ".png")){
                files.push_back(it->path());
            }
        }

-- John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net