powershell sort-object

powershell sort-object

In PowerShell, the Get-ChildItem cmdlet, which is often aliased as dir or ls, can be used to display directory structures and allows you to control the depth of recursion with the -Depth parameter.

sample command :
Get-ChildItem -Path C:\Test\*.txt |
Sort-Object -Property {$_.CreationTime - $_.LastWriteTime} |
Format-Table CreationTime, LastWriteTime, FullName