title: powershell script delete folders regular expression
body: <p>I've written a Powershell script to delete subfolders within a given folder whose name starts with either 0 or 1. This script seems to work only for non-empty folders. I want it to delete the inner contents too. Is there any switch that makes it possible? Also, for some files, I get an error about not having enough permissions whereas the script runs as an administrator.  </p>
  
  <pre><code>$srcFolder = "C:\Documents and Settings\setup\Desktop\Temp\"
  $folderList = Get-Childitem $a | Where-Object {$_.Name -match "^[01]"}
  foreach( $folder in $folderList)
  {
      $tempFolder = $srcFolder + $folder;
      Remove-Item $tempFolder
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Regards,</p>
  
  <p>Sujeet Kuchibhotla</p>