programmazione:logrotate
This is an old revision of the document!
Cancellazione vecchi file di log
# 15 giorni $limit = (Get-Date).AddDays(-15) $path = “C:\Some\Path”
# Cancella i vecchi file Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
# Cancella anche le directory vuote Get-ChildItem -Path $path -Recurse -Force | Where-Object { $_.PSIsContainer -and (Get-ChildItem -Path $_.FullName -Recurse -Force | Where-Object { !$_.PSIsContainer }) -eq $null } | Remove-Item -Force -Recurse
programmazione/logrotate.1790569312.txt.gz · Last modified: by lrosa
