Skip to content

Instantly share code, notes, and snippets.

@martea
Created November 27, 2019 14:55
Show Gist options
  • Save martea/0769cd90281b1e6ba801f30cfa1b701f to your computer and use it in GitHub Desktop.
Save martea/0769cd90281b1e6ba801f30cfa1b701f to your computer and use it in GitHub Desktop.
Remove files older than 30 days
Get-ChildItem -r | ?{ !$_.PSIsContainer } | ?{ $_.LastWriteTime -LT (Get-Date).AddDays(-30)} | Remove-Item -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment