I have a directory having 100 .txt files. I need windows command ( Unix equivalent : head cmd) to list, say only 10 files in my console
1 Answer
Use Powershell
To get the list of files use the below:
Get-ChildItem | Sort-Object LastWriteTime -Descending | Select-Object -first 2
Also to get any specific data use the Select
Example:
Get-ChildItem |Select-Object Name | Sort-Object LastWriteTime -Descending | Select-Object -first 2