How to Sort Files by Date in PowerShell (Modified, Created, Newest)
To sort files by date in PowerShell, pipe Get-ChildItem to Sort-Object LastWriteTime. Add -Descending to put the newest file first: LastWriteTime is the date modified you see in File Explorer. I set up a test folder with known dates and ran every example in PowerShell 7 and Windows PowerShell 5.1. Sort files by date modified … Read more