title: Move files in C#
body: <p>I am moving some images (filenames are<code>(1).PNG</code>, <code>(2).PNG</code> and so on) from one directory to another. I am using the following code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>for (int i = 1; i &lt; n; i++)
  {
      try
      {
          from = "E:\\vid\\(" + i + ").PNG";
          to = "E:\\ConvertedFiles\\" + i + ".png";
          File.Move(from, to); // Try to move
          Console.WriteLine("Moved"); // Success
      }
      catch (IOException ex)
      {
          Console.WriteLine(ex); // Write error
      }
  }
  </code></pre>
  
  <p>However, I am getting the following error:</p>
  
  <p>A first chance exception of type <code>System.IO.FileNotFoundException</code> occurred in mscorlib.dll</p>
  
  <pre class="lang-none prettyprint-override"><code>System.IO.FileNotFoundException: Could not find file 'E:\vid\(1).PNG'.
  </code></pre>
  
  <p>Also, I am planning to rename the files so that the converted file name will be <code>00001.png</code>, <code>00002.png</code>, ... <code>00101.png</code> and so on.  </p>