search folder by using filesystem namespace
Hi all, 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? If not, will boost api support to iterate directories in sorting order? Please provide code snippet if available. Thanks, dd
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
participants (2)
-
dd
-
Nathan Ridge