PowerShell: logifailide kustutaja

From ICO wiki
Revision as of 15:38, 22 May 2012 by Rtetsman (talk | contribs) (Created page with '1 # Kustutab kõik failide logid, mis on vanemad kui 30 päeva 02 param( 03 [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Path, 04 $DaysBack = 30) 05 06 $Curr…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

1

  1. Kustutab kõik failide logid, 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 }