Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PowerShell command to clean temp folder (only if the file or folder hasn't been touched in the last 2 days)
Get-ChildItem $env:temp | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-2)} | Remove-Item -Force -Recurse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment