title: Is there a wildcard expansion option for .net apps?
body: <p>I've used the <a href="http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx" rel="nofollow noreferrer"><code>setargv.obj</code> linking for Expanding Wildcard Arguments</a> in the past for a number of C and C++ apps, but I can't find any similar mention for .net applications.</p>
  <p><strong>Is there a standard way to have your app's command line parameters automatically wildcard expanded?</strong> (i.e. expand <code>*.doc</code> from one entry in args parameter to all that match that wildcard).</p>
  <p>P.S. I've hacked something together with <code>Directory.GetFiles()</code> for my current little project, but it does not cover wildcards with paths (yet), and it would be nice to do it without custom code.</p>
  <p><strong>Update:</strong> here is my rough hack, for illustration. It needs to split the parameters for the path and name for the <code>GetFiles()</code>, but this is a general idea. Linking <code>setargv.obj</code> into a C or C++ app would basically do all the wildcard expansion, leaving the user to only iterate over the argv array.</p>
  <pre class="lang-cs prettyprint-override"><code>public static void Main(string[] args)
  {
      foreach (string argString in args)
      {
          // Split into path and wildcard
          int lastBackslashPos = argString.LastIndexOf('\\') + 1;
          path = argString.Substring(0, lastBackslashPos);
  
          filenameOnly = argString.Substring(lastBackslashPos, argString.Length - lastBackslashPos);
  
          string[] fileList = System.IO.Directory.GetFiles(path, filenameOnly);
          
          foreach (string fileName in fileList)
          {
              // do things for each file
          }
      }
  }
  </code></pre>