title: List files in folder which match pattern
body: <p>I need to list files in directory which match some pattern.
  I tried playing with <code>Directory.GetFiles</code>, but don't fully
  get why it behaves in some way. </p>
  
  <p>1) For example, this code:</p>
  
  <pre><code>            string[] dirs = Directory.GetFiles(@"c:\test\", "*t");
  
              foreach (string dir in dirs)
              {
                  Debugger.Log(0, "", dir);
                  Debugger.Log(0, "", "\n");
  
              }
  </code></pre>
  
  <p>outputs this:</p>
  
  <pre><code>c:\test\11.11.2007.txtGif
  c:\test\12.1.1990.txt
  c:\test\2.tGift
  c:\test\2.txtGif
  c:\test\test.txt
  ...others hidden
  </code></pre>
  
  <p>You can see some files end with <code>f</code> but were still returned by query, <strong>why</strong>?</p>
  
  <p>2) Also, this:</p>
  
  <pre><code>                string[] dirs = Directory.GetFiles(@"c:\test\", "*.*.*.txt");
  
  
                  foreach (string dir in dirs)
                  {
                      Debugger.Log(0, "", dir);
                      Debugger.Log(0, "", "\n");
  
                  }
  </code></pre>
  
  <p>returns this:</p>
  
  <pre><code>c:\test\1.1.1990.txt
  c:\test\1.31.1990.txt
  c:\test\12.1.1990.txt
  c:\test\12.31.1990.txt
  </code></pre>
  
  <p>But <strong>according to the documentation</strong> (<a href="http://msdn.microsoft.com/en-us/library/07wt70x2(v=vs.110).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/07wt70x2(v=vs.110).aspx</a>) I think it had to return also
  this file which is in the directory:</p>
  
  <pre><code>11.11.2007.txtGif
  </code></pre>
  
  <p><strong>since extension (in the query string) is 3 letters long,</strong> <strong>but it didn't</strong>. why?
  (when query extension is 3 letters long, doc says it will return extensions which start with specified extensions too, e.g., see Remarks).</p>
  
  <hr>
  
  <p>Am I the only one who finds these results strange?</p>
  
  <p>Is there any other approach you would recommend for using when one wants to list files in folder which match certain pattern?</p>
  
  <p>User in my case may arbitrarily type some pattern, and I don't want to rely on
  method which I am unsure about the result (like it happened with GetFiles).</p>