Periodically delete the log powershell script

Example:

$FilePath = "C:\Windows\System32\LogFiles"
$DaysAgo=3
$Today=Get-Date  

Get-ChildItem -Path  $FilePath "*.log" | Where-Object {$_.LastWriteTime -lt $Today.AddDays(-$DaysAgo)} |Remove-Item

Guess you like

Origin blog.51cto.com/magic3/2444165