title: Get an ordered list of files in a folder
body: <p>I have used <code>boost::filesystem::directory_iterator</code> in order to get a list of all the available files into a given folder.</p>
  
  <p>The problem is that I supposed this method would give me the files in alphabetical order, while the results seem pretty random.</p>
  
  <p>Is there any fancy way of alphabetically sorting them?</p>
  
  <p>My current code:</p>
  
  <pre><code>if(boost::filesystem::is_directory(myFolder)){
      // Iterate existing files
      boost::filesystem::directory_iterator end_iter;
      for(boost::filesystem::directory_iterator dir_itr(myFolder);
          dir_itr!=end_iter; dir_itr++){
  
          boost::filesystem::path filePath;
          // Check if it is a file
          if(boost::filesystem::is_regular_file(dir_itr-&gt;status())){
              std::cout &lt;&lt; "Reading file " &lt;&lt; dir_itr-&gt;path().string() &lt;&lt; std::cout;
          }
      }
  }
  </code></pre>