title: php rename error: The system cannot find the file specified. (code: 2)
body: <pre><code>&lt;?php
  $dir = opendir('C:\Users\Prometheus\Desktop\milkmaid');
  $i = 1;
  // loop through all the files in the directory
  while (false !== ($file = readdir($dir)))
  {
          if ($file != "." &amp;&amp; $file != "..") {
          $newName = $i.'.mp4';
          $oldname = $file;
          rename($oldname, $newName);
          $i++;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>when i run above script, i am getting following error:</p>
  
  <blockquote>
    <p>The system cannot find the file specified. (code: 2)</p>
  </blockquote>