PowerShell: logifailide kustutaja
From ICO wiki
1
- Kustutab kõik failid mis on vanemad kui 30 päeva
02 param( 03
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Path,
04
$DaysBack = 30)
05
06 $CurrentDate = Get-Date 07 $DatetoDelete = $CurrentDate.AddDays(-$Daysback) 08
09 if($Path -ne ""){ 10
Get-ChildItem $Path | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item
11 }