Powershell script for delete records older than the number of days established.
$Path = "c:\inetpub\logs\LogFiles"
$Daysback = "-60"
$CurrentDate = Get-Date
$DatetoDelete = $CurrentDate.AddDays($Daysback)
Get-ChildItem $Path -Recurse -Force | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item
Top comments (0)