title: Counting subfolders of a folder
body: <p>I am trying to delete ASP .NET temporary files creating a PowerShell script. Until now, I managed to find under <code>C:\Windows\Microsoft .NET\Temporary .NET Files</code> files (not folders) older than 60 days and delete them. But my problem now is that under <code>C:\Windows\Microsoft .NET\Temporary .NET Files</code> there is a folder named <code>root</code>. This folder has only one subfolder. What I want is</p>
  
  <ul>
  <li>Count how many subfolders exist under root folder.</li>
  <li>If there is only one folder, do not do anything.</li>
  <li>If there are more than one, leaves the most recent folder and delete the others.</li>
  </ul>
  
  <p>How could this be done with PowerShell?</p>