Often you may want to use the Where-Object cmdlet in PowerShell to filter for files that have a creation date greater than some specific date.
You can use the following basic syntax to do so:
Get-ChildItem "c:/users/bobbi/data6" | Where-Object { $_.CreationTime -gt [datetime]"2024/04/15" } | Sort-Object CreationTime | Format-Table Name, CreationTime
Here is what this particular example does:
- First, use Get-ChildItem to get all files from the path specified.
- Then, use Where-Object to filter for files where the creation time is greater than (i.e. more recent than) 4/15/2024.
- Then, use Sort-Object to sort the files based on creation time.
- Lastly, use Format-Table to display only the name of the file and the creation time.
The following example shows how to use this syntax in practice.
Example: Use Where-Object to Filter Where Date is Greater Than in PowerShell
Suppose we have a folder located at the following path:
- c:/users/bobbi/data6
We can use the Get-ChildItem cmdlet to retrieve all files in this folder:

Suppose that we would like to filter the folder to only show the files that have a creation time greater than (i.e. more recent than) 4/15/2024.
We can use the following syntax to do so:
Get-ChildItem "c:/users/bobbi/data6" | Where-Object { $_.CreationTime -gt [datetime]"2024/04/15" } | Sort-Object CreationTime | Format-Table Name, CreationTime
The following screenshot shows how to use this syntax in practice:

Notice that this returns only the files that have a creation time greater than 4/15/2024.
Note that we used the -gt operator to filter for files with creation dates “greater than” a specific date.
If you’d like, you could instead use the -lt operator to filter for files with creation dates “less than” a specific date.
Related Tutorials
The following tutorials explain how to perform other common tasks in PowerShell:
PowerShell: How to Use Where-Object in List
PowerShell: How to Use Where-Object is Not Null
PowerShell: How to Use Where-Object with Multiple Conditions
