Try this.
$limit = (Get-Date).AddDays(-8300)
$currentDate = Get-Date -Format "yyyyMMdd_HHmmss"
$path = "C:\temp\deleteme"
$exclude = "_Keep" # Keep or _Keep??
$logfile = "C:\temp\delete$currentDate.log"
# Get folder names that don't contain _Keep
$folders = get-childitem $path -Recurse -Directory | Where-object{$_.fullname.split("\") -notcontains $exclude} # account for subfolders under Keep
"Analyzing these folders." | Out-File -FilePath $logfile -Append
($folders).fullname | Out-File -FilePath $logfile -Append
# Delete files older than the $limit.
"Deleting these files." | Out-File -FilePath $logfile -Append
foreach ($f in $folders) {
$files = Get-ChildItem -Path $f.FullName -File -Force | Where-Object {$_.LastWriteTime -lt $limit }
($files).fullname | Out-File -FilePath $logfile -Append
$files | Remove-Item -Force -whatif
}
# Get-Content $logfile # for testing