Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of files whose creation date is greater than some date time

I have a date 2015/05/28 I want to list all files using order by creation date whose creation date is greater than that using PowerShell. How could I do that?

I googled for it and found Get-ChildItem "C:\Users\gerhardl\Documents\My Received Files" but no idea how to compare it with creation date plus order the result by creation date.

like image 672
Jack Avatar asked Oct 26 '25 20:10

Jack


1 Answers

Get-ChildItem "C:\Users\gerhardl\Documents\My Received Files" | 
    Where-Object { $_.CreationTime -gt [datetime]"2014/05/28" } | 
    Sort-Object CreationTime | 
    Format-Table Name, CreationTime

String is cast to datetime if you specify [datetime] before it. You can read about comparison operators by typing help about_Comparison_Operators in PowerShell console.

like image 120
Varvara Kalinina Avatar answered Oct 29 '25 05:10

Varvara Kalinina