Created
October 10, 2018 15:33
-
-
Save jfrantz1-r7/e86a8f71a84df61960fb4bfa422803e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$limit = (Get-Date).AddDays(-7) | |
$path = "C:\inetpub\Logs\w3svc" | |
# Delete files older than the $limit. | |
Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment