detect arguments from command line
<p>My required commandline is as follow:</p>

<p><code>sortfolder.exe -6.70_Extensions -7</code></p>

<p>where <code>7</code> is in <code>foreach(var file in files.OrderByDescending(x=&gt;x).Skip(7))</code></p>

<p>and <code>-6.70_Extensions</code> is in <code>var di = new DirectoryInfo("C:\\Work\\6.70_Extensions\\Build");</code> and <code>static string path = "C:\\Work\\6.70_Extensions\\Build\\"</code></p>

<p>sortfolder.exe:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace sortfolder
{
    class Program
    {
        static string path = "C:\\Work\\6.70_Extensions\\Build\\";

        static void Main(string[] args)
        {
            var di = new DirectoryInfo("C:\\Work\\6.70_Extensions\\Build");

            foreach (var file in di.GetFiles("*", SearchOption.AllDirectories))
                file.Attributes &amp;= ~FileAttributes.ReadOnly;

            var files = Directory.GetDirectories(path, "SASE Lab Tools.*");
            foreach(var file in files)
            Console.WriteLine(file);
            foreach(var file in files.OrderByDescending(x=&gt;x).Skip(7))
            Console.WriteLine(file);
            foreach(var file in files.OrderByDescending(x=&gt;x).Skip(7))
            Directory.Delete(file, true);
        }
    }
}
</code></pre>

<p>so my commandline is something of the form of:
<code>sortfolder.exe -version -integer</code></p>

<p>and this <code>version</code> could be of any form:</p>

<pre><code>6.70_Extensions
6.80_Extensions
7.00_Main
7.20_Main
8.00_Extensions
etc
</code></pre>

<p>and <code>integer</code></p>

<p>can be any integer</p>

<p>how can i achieve this?</p>

<p>EDIT:</p>

<p>after browsing through <a href="http://msdn.microsoft.com/en-us/library/96s74eb0%28v=VS.90%29.aspx" rel="nofollow">this</a></p>

<p>i edited my code:</p>

<pre><code>namespace sortfolder
{
    class Program
    {
        static void Main(string[] args)
        {
            var di = new DirectoryInfo("C:\\Work\\{0}\\Build", args[0]);
            string path = ("C:\\Work\\{0}\\Build\\", args[0]) ;
            foreach (var file in di.GetFiles("*", SearchOption.AllDirectories))
                file.Attributes &amp;= ~FileAttributes.ReadOnly;

            var files = Directory.GetDirectories(path, "SASE Lab Tools.*");
            foreach(var file in files)
            Console.WriteLine(file);
            foreach(var file in files.OrderByDescending(x=&gt;x).Skip({0}), args[1])
            Console.WriteLine(file);
            foreach(var file in files.OrderByDescending(x=&gt;x).Skip({0}), args[1])
            Directory.Delete(file, true);
        }
    }
}
</code></pre>

<p>something is not right in my syntax??</p>
