title: Is there a faster way to scan through a directory recursively in .NET?
body: <p>I am writing a directory scanner in .NET. </p>
  
  <p>For each File/Dir I need the following info. </p>
  
  <pre><code>   class Info {
          public bool IsDirectory;
          public string Path;
          public DateTime ModifiedDate;
          public DateTime CreatedDate;
      }
  </code></pre>
  
  <p>I have this function: </p>
  
  <pre><code>      static List&lt;Info&gt; RecursiveMovieFolderScan(string path){
  
          var info = new List&lt;Info&gt;();
          var dirInfo = new DirectoryInfo(path);
          foreach (var dir in dirInfo.GetDirectories()) {
              info.Add(new Info() {
                  IsDirectory = true,
                  CreatedDate = dir.CreationTimeUtc,
                  ModifiedDate = dir.LastWriteTimeUtc,
                  Path = dir.FullName
              });
  
              info.AddRange(RecursiveMovieFolderScan(dir.FullName));
          }
  
          foreach (var file in dirInfo.GetFiles()) {
              info.Add(new Info()
              {
                  IsDirectory = false,
                  CreatedDate = file.CreationTimeUtc,
                  ModifiedDate = file.LastWriteTimeUtc,
                  Path = file.FullName
              });
          }
  
          return info; 
      }
  </code></pre>
  
  <p>Turns out this implementation is quite slow. Is there any way to speed this up? I'm thinking of hand coding this with FindFirstFileW but would like to avoid that if there is a built in way that is faster. </p>