0
Answered
Execute PowerShell script: example of common requirement to delete log files older than a specified interval
I used the following script to delete rolling log files generated by both a SSIS package as well as the FIM Operations History files ... thereby making sure disk space usage was kept within limits. This would be a useful script to post on the Event Broker wiki as an example usage of the "Execute PowerShell Script" plug-in ... just copy this code:
# Delete all *.log Files in target folder older than 21 day(s) $Path = "\\MyServerFileShare\Logs\MyApplication" $Daysback = "-21" $Extension = "*.log" $CurrentDate = Get-Date $DatetoDelete = $CurrentDate.AddDays($Daysback) Get-ChildItem $Path -Include $Extension -Recurse | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item
Customer support service by UserEcho
Please see https://unifysolutions.jira.com/wiki/display/EB/2013/03/13/Delete+old+files+using+PowerShell+Script+operation.
Thanks Adam