How to skip a sub-directory with filesystem3::recursive_directory_iterator in case of exception?
I am iterating a mapped network drive under windows, K:\, under which
are 3 sub directories A, B, C, where K:\B is only visible itself but
cannot be iterated into due to group policy.
With code below:
boost::system::error_code ec;
for (recursive_directory_iterator itr(root, ec), itr_end; itr!=itr_end;
itr++)
{ ... }
It throws in itr++ when itr->path() == "K:\B".
I would like to skip going into k:\B and go on with K:\C, so I code like
this:
for (recursive_directory_iterator itr(root, ec), itr_end; itr!=itr_end;
)
{
... ;
itr.increment(ec);
}
It does not solve my problem, but introduces one more:
itr will never equal to itr_end even though all item are iterated over,
and this happens for any normal folder such as K:\A. thus never get's
out of for loop until the internal
vetor
participants (1)
-
Tan, Tom (Shanghai)