Track creation and modification activity using explicit time windows.

Sheet: 05 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026

PowerShell cheat sheet index

Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.

Quick commands

1. Files modified within the last 20 minutes

$cutoff = (Get-Date).AddMinutes(-20)
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Where-Object { $_.LastWriteTime -ge $cutoff }

2. Files created today

$start = (Get-Date).Date
$end = $start.AddDays(1)
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Where-Object { $_.CreationTime -ge $start -and $_.CreationTime -lt $end }

3. HTML files modified within a fixed week

$start = Get-Date -Year 2026 -Month 11 -Day 16 -Hour 0 -Minute 0 -Second 0
$end = $start.AddDays(7)
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File -Filter '*.html' |
    Where-Object { $_.LastWriteTime -ge $start -and $_.LastWriteTime -lt $end }

4. Show the 20 most recently modified files

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Sort-Object LastWriteTime -Descending | Select-Object -First 20 FullName, LastWriteTime

5. Files older than 90 days

$cutoff = (Get-Date).AddDays(-90)
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Where-Object { $_.LastWriteTime -lt $cutoff }

Operational notes

CreationTime can change when a file is copied or extracted; LastWriteTime may be preserved by archive tools. Neither proves original authorship or publication. Use inclusive start and exclusive end for adjacent time windows.

Official documentation