Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Last active March 14, 2022 15:57
Show Gist options
  • Save JohnL4/affad64b6e3c3d2ecf13d5dece2e6fb3 to your computer and use it in GitHub Desktop.
Save JohnL4/affad64b6e3c3d2ecf13d5dece2e6fb3 to your computer and use it in GitHub Desktop.
File cleanup
$mb = 1024*1024
$days60 = (Get-Date).AddDays(-60)
ls | ? {($_.Length -gt 180*$mb) -and ($_.LastWriteTime -lt $days60)}
# Can pipe above cmd to 'rm -vb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment