When Sage 500 creates a back up plan, the Step within the job has the Option RetainDays included with it. The question came up today if this option deletes the older back files the job created. The option does not delete any back up files. The option RETAINDAYS achieves a very different purpose with Backup. It just prevents users from overwriting the backup file if the user is trying to do it with INIT option. Otherwise, it really does not do anything else. If the user is using the FORMAT option, the backup will be overwritten anyway. This means the use of RETAINDAYS is very much limited.
If you need a way to delete older backup files, you can create a .BAT file or a PowerShell script which can then be scheduled with the Task Scheduler to run automatically.
The code for the .BAT file would be similar to the following:
c:\Windows\System32>ForFiles /p "C:\Junk" /s /d -30 /c "cmd /c del @file"
Substitute the folder path and the amount of days with desired values and you are done
For PowerShell it would be as follows:
# Delete all Files in a folder older than 30 days
$Path = "C:\Junk"
$Daysback = "-30"
$CurrentDate = Get-CurrentDate
$DatetoDelete = $CurrentDate.AddDays($Daysback)
Get-ChildItem $Path | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item