In this tutorial, I will explain how to find files modified after a specific date using PowerShell. If you work as a PowerShell administrator managing files on Windows systems, you will likely encounter this requirement, such as finding items modified after specific dates.
Let’s explore how to use PowerShell to locate files based on their modification timestamps.
Understanding File Modification Times in PowerShell
Before diving into the commands, it’s important to understand how PowerShell handles file modification times.
PowerShell tracks several time-related properties for files:
- LastWriteTime: The time when the file was last modified
- CreationTime: When the file was created
- LastAccessTime: When the file was last accessed
For finding modified files, we’ll primarily use the LastWriteTime property, which is the most common way to check when files were modified.
Method 1: Using Get-ChildItem with Where-Object
The most straightforward approach is to combine Get-ChildItem with Where-Object to filter results based on the modification date.
This method gives you great flexibility as it allows you to search through directories and apply specific date filters.
I’ve used this approach countless times when auditing file changes across enterprise systems.
Here is the PowerShell script:
Get-ChildItem C:\Reports -Recurse | Where-Object { $_.LastWriteTime -gt '06/01/2025' }This command finds all files in the C:\Reports folder (including subfolders) modified after June 1, 2025.
Here is the exact output in the screenshot below:

You can also use a more readable date format:
Get-ChildItem C:\Projects -Recurse | Where-Object { $_.LastWriteTime -gt (Get-Date "2025-06-01") }Filter by File Type
To narrow down results to specific file types, you can filter them using the -include parameter.
This approach is particularly useful when you only need to find certain file types, like when I needed to locate only recently modified Excel files in our financial department.
The -Include parameter accepts wildcards, making it versatile for various file extensions.
Get-ChildItem C:\Financial\Reports -Recurse -Include *.xlsx,*.pdf | Where-Object { $_.LastWriteTime -gt '06/01/2025' }This command only shows Excel spreadsheets and PDF files modified after the specified date.
Check out Find Files Modified in the Last 24 Hours in PowerShell
Method 2: Find Files Modified in the Last X Days
Often, you’ll want to find files modified within a recent timeframe rather than after a specific date.
This technique is incredibly useful for recurring maintenance tasks that require processing recently changed files.
I regularly use this approach when performing weekly backup validations for our critical systems.
Get-ChildItem C:\Users\Bijay\Documents -Recurse | Where-Object { $_.LastWriteTime -ge (Get-Date).AddDays(-7) }This command finds all files modified within the last 7 days in John’s Documents folder.
You can adjust the number of days as needed:
# Files modified in the last 30 days
Get-ChildItem C:\Data -Recurse | Where-Object { $_.LastWriteTime -ge (Get-Date).AddDays(-30) }
# Files modified in the last 24 hours
Get-ChildItem C:\Logs -Recurse | Where-Object { $_.LastWriteTime -ge (Get-Date).AddHours(-24) }Read Show Progress When Copying Files with PowerShell Copy-Item
Method 3: Find Files Modified Between Two Dates
Sometimes, you need to find files that were modified within a specific date range.
This method is ideal for investigating changes within a specific timeframe, such as when I had to audit file modifications during a system migration period.
Using both lower and upper date boundaries gives you precise control over your search criteria.
Get-ChildItem C:\Marketing\Campaigns -Recurse | Where-Object {
$_.LastWriteTime -ge '01/01/2025' -and $_.LastWriteTime -le '06/10/2025'
}This finds files modified between January 1, 2025, and June 10, 2025.
For better readability:
$startDate = Get-Date "2025-01-01"
$endDate = Get-Date "2025-06-10"
Get-ChildItem C:\Marketing\Campaigns -Recurse | Where-Object {
$_.LastWriteTime -ge $startDate -and $_.LastWriteTime -le $endDate
}Check out Find Files Modified Between Dates Using PowerShell
Method 4: Create Reusable Functions
For repeated use, I recommend creating a reusable function in PowerShell:
When I support multiple departments, I create custom PowerShell functions like this one to standardize file search operations.
This approach encapsulates the logic in a reusable component, improving consistency and reducing errors across your scripts.
function Find-FilesModifiedAfter {
param (
[Parameter(Mandatory=$true)]
[string]$Path,
[Parameter(Mandatory=$true)]
[datetime]$Date,
[string[]]$Include,
[switch]$Recurse
)
$params = @{
Path = $Path
Recurse = $Recurse
}
if ($Include) {
$params.Add("Include", $Include)
}
Get-ChildItem @params | Where-Object { $_.LastWriteTime -gt $Date }
}Usage examples:
# Find all PowerPoint presentations modified after May 15, 2025
Find-FilesModifiedAfter -Path "C:\Presentations" -Date "05/15/2025" -Include "*.pptx" -Recurse
# Find all files modified after June 1, 2025 in the current directory
Find-FilesModifiedAfter -Path "." -Date "06/01/2025"Check out Create a Folder with Today’s Date and Copy Files to it using PowerShell
Method 5: Export Results to CSV
When dealing with large numbers of files, it’s helpful to export the results:
I frequently use this technique to generate reports for our compliance team, as it allows for easy documentation of file changes.
The resulting CSV files can be opened in Excel, making the data accessible to non-technical stakeholders.
Get-ChildItem C:\Projects -Recurse |
Where-Object { $_.LastWriteTime -gt '06/01/2025' } |
Select-Object FullName, LastWriteTime, Length |
Export-Csv -Path "C:\Reports\RecentlyModifiedFiles.csv" -NoTypeInformationThis creates a CSV report with the file path, modification time, and size.
Method 6: Using PowerShell with Command Line Arguments
For automation scripts, you can use command-line arguments:
This approach is perfect for scheduled tasks where parameters might change, such as the backup verification script I created for one of our clients at their Washington DC office.
Parameterizing your scripts makes them more flexible and reusable across different scenarios.
$path = $args[0]
$daysBack = [int]$args[1]
$cutoffDate = (Get-Date).AddDays(-$daysBack)
Get-ChildItem -Path $path -Recurse |
Where-Object { $_.LastWriteTime -ge $cutoffDate } |
Select-Object FullName, LastWriteTimeSave this as FindRecentFiles.ps1 and run:
.\FindRecentFiles.ps1 "C:\ImportantData" 14This finds files modified in the last 14 days in the specified folder.
Read Create Files with Content Using PowerShell
Tips and Best Practices
Here are some additional tips based on my experience:
Improve Performance
When searching large directories:
- Limit recursion when possible: Only use -Recurse when necessary. I’ve seen scripts take hours when recursive searches weren’t truly needed. Be selective about when you use this parameter.
- Use filters instead of pipes for large directories:
# More efficient for large directories
Get-ChildItem C:\LargeFolder -Recurse -File | Where-Object { $_.LastWriteTime -gt '06/01/2025' }The -File parameter prevents PowerShell from processing directories unnecessarily, which can significantly improve performance.
- Consider using
-Filterparameter for initial filtering:
Get-ChildItem C:\BigData -Recurse -Filter "*.log" | Where-Object { $_.LastWriteTime -gt '06/01/2025' }Filtering at the file system level is much faster than filtering in PowerShell, especially for large directories.
Common Pitfalls to Avoid
- Date format confusion: Be aware of your system’s date format settings. I once troubleshot a script for hours only to discover the issue was date formatting differences between our US and European offices.
- Time zone issues: Remember that file times are stored in local time. This becomes especially important when processing files across different geographic locations or time zones.
- Permission issues: Make sure you have access to the directories you’re searching. Running your PowerShell session with elevated privileges can help avoid permission-related errors during file searches.
Conclusion
PowerShell provides multiple efficient ways to find files modified after specific dates across your Windows systems.
The methods we’ve explored range from simple one-liners to more complex functions that can be integrated into your automation script.
I’ve personally used these techniques in enterprise environments to track changes, validate backups, and maintain system integrity.
I hope you now understand how to get files modified after a specified date in PowerShell.
You may also like the following tutorials:
- Get All Files in a Directory Using PowerShell
- Create a File in the Current Directory Using PowerShell
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.