<small id='ICNPL'></small><noframes id='ICNPL'>

    <i id='ICNPL'><tr id='ICNPL'><dt id='ICNPL'><q id='ICNPL'><span id='ICNPL'><b id='ICNPL'><form id='ICNPL'><ins id='ICNPL'></ins><ul id='ICNPL'></ul><sub id='ICNPL'></sub></form><legend id='ICNPL'></legend><bdo id='ICNPL'><pre id='ICNPL'><center id='ICNPL'></center></pre></bdo></b><th id='ICNPL'></th></span></q></dt></tr></i><div id='ICNPL'><tfoot id='ICNPL'></tfoot><dl id='ICNPL'><fieldset id='ICNPL'></fieldset></dl></div>
    • <bdo id='ICNPL'></bdo><ul id='ICNPL'></ul>
    <tfoot id='ICNPL'></tfoot>
      <legend id='ICNPL'><style id='ICNPL'><dir id='ICNPL'><q id='ICNPL'></q></dir></style></legend>

      1. boost::filesystem::recursive_directory_iterator 带过滤器

        时间:2023-07-19

        <small id='g7vVT'></small><noframes id='g7vVT'>

          • <bdo id='g7vVT'></bdo><ul id='g7vVT'></ul>

              <tfoot id='g7vVT'></tfoot>
              <legend id='g7vVT'><style id='g7vVT'><dir id='g7vVT'><q id='g7vVT'></q></dir></style></legend>
                <tbody id='g7vVT'></tbody>

                  <i id='g7vVT'><tr id='g7vVT'><dt id='g7vVT'><q id='g7vVT'><span id='g7vVT'><b id='g7vVT'><form id='g7vVT'><ins id='g7vVT'></ins><ul id='g7vVT'></ul><sub id='g7vVT'></sub></form><legend id='g7vVT'></legend><bdo id='g7vVT'><pre id='g7vVT'><center id='g7vVT'></center></pre></bdo></b><th id='g7vVT'></th></span></q></dt></tr></i><div id='g7vVT'><tfoot id='g7vVT'></tfoot><dl id='g7vVT'><fieldset id='g7vVT'></fieldset></dl></div>
                • 本文介绍了boost::filesystem::recursive_directory_iterator 带过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要递归地从目录及其子目录中获取所有文件,但不包括几个目录.我知道他们的名字.是否可以使用 boost::filesystem::recursive_directory_iterator ?

                  I need to recursively get all files from directory and it's subdirectory, but excluding several directory. I know their names. Is it possible to do with boost::filesystem::recursive_directory_iterator ?

                  推荐答案

                  是的,在遍历目录时,您可以测试排除列表中的名称并使用 no_push() 成员递归迭代器以防止它进入这样的目录,例如:

                  Yes, while iterating over directories, you can test for the names on your exclusion list and use the no_push() member of the recursive iterator to prevent it from going into such a directory, something like:

                  void selective_search( const path &search_here, const std::string &exclude_this_directory)
                  {
                      using namespace boost::filesystem;
                      recursive_directory_iterator dir( search_here), end;
                      while (dir != end)
                      {
                          // make sure we don't recurse into certain directories
                          // note: maybe check for is_directory() here as well...
                          if (dir->path().filename() == exclude_this_directory)
                          {
                              dir.no_push(); // don't recurse into this directory.
                          }
                  
                          // do other stuff here.            
                  
                          ++dir;
                      }
                   }
                  

                  这篇关于boost::filesystem::recursive_directory_iterator 带过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:C++ Boost:BOOST_FOREACH 有什么问题吗? 下一篇:打印所有 std::locale 名称 (Windows)

                  相关文章

                    <legend id='sj9aP'><style id='sj9aP'><dir id='sj9aP'><q id='sj9aP'></q></dir></style></legend>
                    • <bdo id='sj9aP'></bdo><ul id='sj9aP'></ul>
                  1. <i id='sj9aP'><tr id='sj9aP'><dt id='sj9aP'><q id='sj9aP'><span id='sj9aP'><b id='sj9aP'><form id='sj9aP'><ins id='sj9aP'></ins><ul id='sj9aP'></ul><sub id='sj9aP'></sub></form><legend id='sj9aP'></legend><bdo id='sj9aP'><pre id='sj9aP'><center id='sj9aP'></center></pre></bdo></b><th id='sj9aP'></th></span></q></dt></tr></i><div id='sj9aP'><tfoot id='sj9aP'></tfoot><dl id='sj9aP'><fieldset id='sj9aP'></fieldset></dl></div>

                      <tfoot id='sj9aP'></tfoot>

                      <small id='sj9aP'></small><noframes id='sj9aP'>