title: Using PowerShell to filter folders by date
body: <p>I am going through folders we have on a work drive that have files over 20 years old in them. We want to move these files off this drive to clear up room and organize it better. </p>
  
  <p>I have a PowerShell script to look through the folders and output to a csv file. </p>
  
  <p>It puts into the csv file but there are thousands of files here. We only want to have the file with the latest modified on there. It is giving me every file. </p>
  
  <p>Can I have it only output the latest modified file from that folder and then move onto the next folder?</p>
  
  <pre><code>Get-ChildItem -LiteralPath Y:\XYZ\MainFolder -Recurse -Depth 2  |Format-Table| Out-File C:\Users\USER\Desktop\aCSVfile.csv
  </code></pre>