9 Jul
2014
9 Jul
'14
1:47 a.m.
I want to search for a folder in a particular directory in any level. Is there any direct api to search folder by using filesystem namespace?
You want recursive_directory_iterator. For example, to search a directory '/home/foo' for a subdirectory 'bar' at any level, you can do: using namespace boost::filesystem; for (recursive_directory_iterator cur("/home/foo"), end; cur != end; ++cur) { if (cur->status().type() == directory_file && cur->path() == "bar") { // Found it } } Hope that helps, Nate