public/LogFiles/Remove-LogFiles.ps1
using namespace System.Management.Automation using module '..\..\modules\Enums.psm1' using module '..\..\modules\Helper\DateTimeHelper.psm1' using module '..\..\modules\Session.psd1' function Remove-LogFiles{ [CmdletBinding()] [Alias('rmalf')] param ([string]$timespan='-15D') $afterDateTime, $beforeDateTime = [DateTimeHelper]::getAfterBefore('', $timespan) Get-ChildItem -Path [Config].instance.auditFolder -Recurse | Where-Object ` { ($_.LastWriteTime -lt $beforeDateTime) -and ($_.LastWriteTime -gt $afterDateTime) -and -not $_.PSIsContainer } | ` Remove-Item | Out-Null Write-Host ($LocalizedData.AudigLogsRemovedMessage -f $beforeDateTime) -ForegroundColor Green } |