<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 12/09/2016 03:15 PM, Frank Muller
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAFA6GnCCCDVhsCC_QYv3HJAuowU-_uT3EwHeSr=4e1rRo+b3EQ@mail.gmail.com"
      type="cite">
      <div class=""
        style="font-family:UICTFontTextStyleBody;font-size:17px">
        <div class="">Hi</div>
        <div class=""><br class="">
        </div>
        <div class="">I would like to improve the speed of my directory
          walker.</div>
        <div class=""><br class="">
        </div>
        <div class="">walk(Dir) -></div>
        <div class="">    {ok, Files} = prim_<a class="moz-txt-link-freetext" href="file:list_dir(Dir)">file:list_dir(Dir)</a>,</div>
        <div class="">    walk(Dir, Files).</div>
        <div class=""><br class="">
        </div>
        <div class="">walk(Dir, [ Basename | Rest ]) -></div>
        <div class="">    Path = filename:join([ Dir, Basename ]),</div>
        <div class="">    case filelib:is_dir(Path) of</div>
        <div class="">        true  -></div>
        <div class="">            walk(Path);</div>
        <div class="">        false -></div>
        <div class="">            io:format("~s~n", [Path]),</div>
        <div class="">            filelib:file_size(Path)</div>
        <div class="">    end,</div>
        <div class="">    walk(Dir, Rest);</div>
        <div class="">walk(_, []) -></div>
        <div class="">    ok.</div>
      </div>
      <div class=""
        style="font-family:UICTFontTextStyleBody;font-size:17px"><br
          class="">
      </div>
      <div class=""
        style="font-family:UICTFontTextStyleBody;font-size:17px"><br
          class="">
      </div>
      <div class=""
        style="font-family:UICTFontTextStyleBody;font-size:17px">Compared
        to almost anything i found on the web, it’s still very slow:</div>
      <div class=""
        style="font-family:UICTFontTextStyleBody;font-size:17px">
        <div class="">> timer:tc(fun() -> dir:walk("/usr/share")
          end).</div>
      </div>
      <div class=""
        style="font-family:UICTFontTextStyleBody;font-size:17px">{<a
          moz-do-not-send="true" href="tel:4662361" dir="ltr">4662361</a>,ok}</div>
    </blockquote>
    <br>
    Have you tried filelib:fold_files/5
    (<a class="moz-txt-link-freetext" href="http://erlang.org/doc/man/filelib.html#fold_files-5">http://erlang.org/doc/man/filelib.html#fold_files-5</a>) ?<br>
    <br>
  </body>
</html>