|
Boost : |
Subject: Re: [boost] search folder by using filesystem namespace
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2014-07-08 21:47:36
> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk