top of page

Powershell–Delete files older than (xxx)

  • Yazarın fotoğrafı: Enis GOKTAY
    Enis GOKTAY
  • 28 Nis 2014
  • 1 dakikada okunur

Merhaba,

Aşağıdaki scriptte, belirtilen bir günden sonra ilgili path’ten dosyaları silebiliriz

# Limit belirtilir.

$limit = (Get-Date).AddDays(-180)

#Path belirtilir. $path = “C:\inetpub\logs\LogFiles\W3SVC1\”

# Limit dahilinde ilgili path’teki dosyalar silinir.

Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force

Son Yazılar

Hepsini Gör

Comments


Abonelik Formu

Gönderdiğiniz için teşekkür ederiz!

bottom of page