Last active
October 1, 2019 21:11
-
-
Save Swimburger/5b5babedea2528da34799fb44c7c154f to your computer and use it in GitHub Desktop.
Delete files last modified more than 30 days ago from https://www.swimburger.net/blog/azure/deleting-old-web-app-logs-using-azure-web-jobs-and-powershell
This file contains 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
$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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a blog post to put the removelogfiles script into an Azure WebJob.