title: File rename failing on web server
body: <p>I have the following script which works fine locally:</p>
  
  <pre><code>    &lt;?php
  
  //Report all errors
  error_reporting(E_ALL);
  
  if ($handle = opendir('instance/system/application/images/dir/testimages/')){
  
      while (false !== ($fileName = readdir($handle))){
          $newName = str_replace(" ", "_", $fileName);
          rename($fileName, $newName);
      }
  
      echo "All files have been renamed";
      closedir($handle);
  }
  ?&gt;
  </code></pre>
  
  <p>However when run on the web server I get the following error:</p>
  
  <p>Warning: rename(.,.) [function.rename]: Permission denied in C:\inetpub\vhosts\domain.com\httpdocs\rename.php on line 10</p>
  
  <p>Any idea how I can resolve this?</p>
  
  <p>Cheers</p>
  
  <p>Note:</p>
  
  <p>I am using IIS7 and a windows server.</p>