Skip to content

Instantly share code, notes, and snippets.

@Swimburger
Last active October 1, 2019 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swimburger/5b5babedea2528da34799fb44c7c154f to your computer and use it in GitHub Desktop.
Save Swimburger/5b5babedea2528da34799fb44c7c154f to your computer and use it in GitHub Desktop.
$LogFolder = "D:\home\site\wwwroot\App_Data\Logs";
$DaysToKeepLogsAround = 30;
Get-ChildItem -Path $LogFolder -Recurse -File | Where LastWriteTime -lt (Get-Date).AddDays(-$DaysToKeepLogsAround) | Remove-Item -Force
@Swimburger
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment