c++ - walk - boost::filesystem::recursive_directory_iterator with filter

boost:: filesystem:: directory_iterator:: construct no such file or directory (1)

I need to recursively get all files from directory and it's subdirectory, but excluding several directory. I know their names. Is it possible to do with boost::filesystem::recursive_directory_iterator ?

Yes, while iterating over directories, you can test for the names on your exclusion list and use the no_push() member of the recursive iterator to prevent it from going into such a directory, something like:

void selective_search( const path &search_here, const std::string &exclude_this_directory)
    using namespace boost::filesystem;
    recursive_directory_iterator dir( search_here), end;
    while (dir != end)
        // make sure we don't recurse into certain directories
        // note: maybe check for is_directory() here as well...
        if (dir->path().filename() == exclude_this_directory)
            dir.no_push(); // don't recurse into this directory.

        // do other stuff here.