How can I sort files based on their last updated time using "dir" command in Windows

Viewed 428

I am using "dir" command on the command line prompt in Windows 10. I've tried the following:

c:\my_folder> dir /s /b

but, the above command is not displaying the files according to the last updated time of files.

1 Answers

Open a powershell console and enter this command:

Get-ChildItem | Sort-Object -Property LastWriteTime

If you want descending order, then use:

Get-ChildItem | Sort-Object -Property LastWriteTime -Descending
Related