Delete files older than X days on Windows 10 from PowerShell
xxxxxxxxxx
Get-ChildItem –Path "C:\path\to\folder" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item
xxxxxxxxxx
Get-ChildItem "C:\temp" -Recurse -File | Where CreationTime -lt (Get-Date).AddDays(-15) | Remove-Item -Force
xxxxxxxxxx
Get-ChildItem –Path "C:\path\to\folder" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item
xxxxxxxxxx
Get-ChildItem -Path "C:\Temp\temp" -Directory -recurse| where {$_.LastWriteTime -le $(get-date).Adddays(-10)} | Remove-Item -recurse -force
Get-ChildItem -Path "C:\Temp\temp" -File -recurse| where {$_.LastWriteTime -le $(get-date).Adddays(-10)} | Remove-Item -recurse -force