Find Modified Files In a Folder (By Age and Date)

Find Modified Files In a Folder KB ID 0001812

Problem

You need to find a modified file in a folder, there are a few ways to do this, the best options are via PowerShell, but you can also use the search function in Normal Windows Explorer.

Solution Find Modified Files In a Folder: Graphically

Strangely the option you want you cannot see unless you click into the search field, once you do that Search will be visible on the menu ribbon.

Seelct Date Modified, then choose an option.

Solution Find Modified Files In a Folder: PowerShell

Any ‘mundane’ task is always done better with a bit of scripting!

Find Modified Files in a Folder (In the last month)

Use the following syntax,

[box]

$timerange (Get-Date).AddMonths(-1)
Get-Children C:\FOLDER-NAME -File | Where-Object {$_.LastWriteTime -ge $timerange}

[/box]

Note: you can use something like .AddDays(-30)  also if you prefer.

Find Modified Files in a Folder and all sub-folders (In the last month)

Use the following syntax,

[box]

$timerange (Get-Date).AddMonths(-1)
Get-Children C:\FOLDER-NAME -File -Recurse | Where-Object {$_.LastWriteTime -ge $timerange}

[/box]

Find Modified Files in a Folder and all sub-folders (and output to CSV)

To take that output and put it into a CSV file use the following synatax.

[box]

$timerange (Get-Date).AddMonths(-1)
Get-ChildItem E:\Dropbox -File -Recurse | Where-Object {$_.LastWriteTime -ge $timerange} | Select-Object -Property Name, BaseName, Extension, FullName, DirectoryName, LastWriteTime, Length | Export-Csv -NoTypeInformation -Path C:\Temp\MODIFIED-FILES.csv

[/box]

Find Modified Files in a Folder and all sub-folders (Between Certain Dates)

Use the following syntax

[box]

Get-ChildItem E:\Dropbox -File -Recurse | Where-Object {($_.LastWriteTime -ge '2022-01-01') -and ($_.LastWriteTime -le '2022-12-31')} | Select-Object FullName, LastWriteTime

[/box]

Note: Unfortunately you have to format the dates in YYYY-MM-DD format.

Related Articles, References, Credits, or External Links

NA

Leave a Reply

Your email address will not be published. Required fields are marked *