title: Delete complete folder using a PowerShell script
body: <p>I am using the following expression to delete a folder from PowerShell. I need to delete a complete folder (including all the files and sub folders).</p>
  
  <pre><code>Remove-Item -Recurse -Force $DesFolder
  </code></pre>
  
  <p>But this gives me the exception <strong>"The directory is not empty"</strong></p>
  
  <p>I am not getting this exception every time when I run the program; it happens randomly. What would be the reason for this and how do I fix this? Because I was failing to reproduce this.</p>