title: Permission errors in PowerShell
body: <p>I am new to PowerShell. When trying to write a simple script that deletes the contents of a folder and then fills it with files copied from a different folder, I always get a <code>PermissionDenied</code> error. </p>
  
  <p>Details: </p>
  
  <pre><code>+ remove-item &lt;&lt;&lt;&lt;  D:\path\* -recurse
      + CategoryInfo : PermissionDenied: (save.gif:FileInfo) [Remove-Item], IOException
      + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
  </code></pre>
  
  <p>Where is the problem? I am able to manipulate both folders through Explorer. 
  The error occurs both when running from a script file and from shell (using Windows PowerShell ISE).
  The ISE process runs under my account. 
  I'm running Windows 7 Professional and am a local administrator. </p>
  
  <p><strong>Edit:</strong> 
  After Richard's suggestion, I tried the verbose mode (which seemed to have no effect). </p>
  
  <pre><code>PS Z:\&gt; $error[0] | fl * -force
  
  PSMessageDetails      : 
  Exception             : System.IO.IOException: Not Enough permission to perform operation.
  TargetObject          : D:\path\file.txt
  CategoryInfo          : PermissionDenied: (D:\path\file.txt:FileInfo) [Remove-Item], IOException
  FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
  ErrorDetails          : Cannot remove item D:\path\file.txt: Not Enough permission to perform operation.
  InvocationInfo        : System.Management.Automation.InvocationInfo
  PipelineIterationInfo : {0, 1}
  </code></pre>
  
  <p>I don't see anything of much use there (but thanks for the tips anyway).</p>
  
  <p><strong>Edit 2:</strong>
  Okay, here's the script source: </p>
  
  <pre><code>remove-item D:\path_A\* -recurse
  copy-item D:\path_B\* D:\path_A\
  </code></pre>
  
  <p>That's it. The remove-item seems to throw at every file.</p>