title: Folder cleanup with PowerShell
body: <p>I'd like to clean up some directories after my script runs by deleting certain folders and files from the current directory if they exist. Originally, I structured the script like this:</p>
  
  <pre><code>if (Test-Path Folder1) {
    Remove-Item -r Folder1
  }
  if (Test-Path Folder2) {
    Remove-Item -r Folder2
  }
  if (Test-Path File1) {
    Remove-Item File1
  }
  </code></pre>
  
  <p>Now that I have quite a few items listed in this section, I'd like to clean up the code. How can I do so?</p>
  
  <p>Side note: The items are cleaned up <em>before</em> the script runs, since they are left over from the previous run in case I need to examine them.</p>