
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<directory_iterator>::operator+=() asserts. Again, I tried something like below. for (recursive_directory_iterator itr(root, ec), itr_end; itr!=itr_end; ) { ... ; itr.increment(ec); if(ec) itr.pop(); } This time itr.pop() assertion fails because "pop() on recursive_directory_iterator with level < 1" Anybody got some advice? Thanks.