How to increment the folder number if folder already exist in a directory
<p>Ex. If I created a folder with a folder name of IMG10001 but it was already exist in the target directory. The code below will make the folder name to IMG10001-1 but what I like to accomplish is to increment the folder name to IMG10002 if IMG10001 already exist in the target directory. </p>

<pre><code>string destinDir = dirPath + "\\" + this.Batch.BatchName;
int x = 0;
if (Directory.Exists(destinDir))
{
    do
    {
        x++;
        destinDir = dirPath + "\\" + this.Batch.BatchName + "-" + x.ToString();
    } while (Directory.Exists(destinDir));
}    
System.IO.Directory.Move(root,destinDir);
</code></pre>
