title: PowerShell format output
body: <p>I'm trying to write a script that deletes all folders that are older than 60 days and create a logfile with the folder names in the directory where the folders have been deleted.</p>
  
  <p>What I have now is:</p>
  
     
  
  <pre class="lang-powershell prettyprint-override"><code>Get-ChildItem -Directory -Path "\\share\dir1\dir2" | 
      Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-10) } | 
      Remove-Item -Force -Recurse | Out-File Auto_Clean.log -Append -WhatIf
  </code></pre>
  
  <p>The output stays like this for ages:</p>
  
  <pre class="lang-powershell prettyprint-override"><code>What if: Performing the operation "Output to File" on target "C:\users\bgijbels\Downloads\Auto_Clean.log".
  </code></pre>
  
  <p>When I remove the part for <strong>Out-File</strong> it works fine. It seems like the Out-File part is trying to write the name of every file in the folder to the log, while I only need to have the folder name. I think that's why it takes so long, if at all it gets past the part of creating the logfile. Any ideas? Thank you for your help.</p>