$ErrorActionPreference = "silentlycontinue"
$lastPath = ""
$pathColor = "Green"
$fileNameColor = "Cyan"
Get-ChildItem -Path "C:\" -Recurse -File | Where-Object {$_.LastWriteTime -gt (Get-Date).AddMonths(-3)} | Sort-Object LastWriteTime -Descending | ForEach-Object {
$currentPath = Split-Path $_.FullName -Parent
$fileName = Split-Path $_.FullName -Leaf
$modificationDate = $_.LastWriteTime.ToString("yyyy-MM-dd HH:mm")
if ($currentPath -ne $lastPath) {
$lastPath = $currentPath
$pathColor = if ($pathColor -eq "Green") {"Yellow"} else {"Green"}
}
Write-Host "[$modificationDate] " -NoNewline -ForegroundColor "Gray"
Write-Host $currentPath -NoNewline -ForegroundColor $pathColor
Write-Host ("\\" + $fileName) -ForegroundColor $fileNameColor
}