title: recursive_directory_iterator throws exception
body: <p>I am using the boost iterator "recursive_directory_iterator" to recursively scan through a directory.  However, when the iterator runs into a directory for which my application does not have access, exception of type "boost::filesystem3::filesystem_error" is thrown, which halts the iterator and the program aborts.  Is there anyway I can instruct the iterator to skip over such directories.</p>
  
  <p>I tried the code suggested at <a href="https://stackoverflow.com/questions/15970013/traversing-a-directory-with-boostfilesystem-without-throwing-exceptions">Traversing a directory with boost::filesystem without throwing exceptions</a>   However, it did nor work for me.  I am using boost version 1.49.</p>
  
  <p>My code after following the suggestion (the best I could come up with), looks as follows:</p>
  
  <pre><code>void scand()
  {
      boost::system::error_code ec, no_err;
  
      // Read dir contents recurs
      for (recursive_directory_iterator end, _path("/tmp", ec);
           _path != end; _path.increment(ec)) {
  
          if (ec != no_err) {
              _path.pop();
              continue;
          }
          cout &lt;&lt; _path-&gt;path() &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>Thank you,
  Ahmed.</p>