The backup tool can use the --retainPreviousFullBackupCount or --retainPreviousFullBackupAge arguments to identify which previous backups to preserve.
Any other backups in that directory are removed. A new backup is always preserved. If the new backup is an incremental backup, then any other backups it depends on are also preserved. However, older backups in the same directory are eligible to be removed.
If you include the --retainPreviousFullBackupCount argument, that number of the most recent previous full backups are preserved, along with any incremental backups that depend on them. Any other previous full backups, and their dependent incremental backups, are removed. A value of zero can be specified for the --retainPreviousFullBackupCount argument so that only the most recent backup is preserved, along with its dependencies, and all previous backups are removed.
If you include the --retainPreviousFullBackupAge argument, its value must be a duration represented as an integer followed by a time unit. Any full backups (and their dependent incremental backups) created longer ago than that duration are eligible to be removed.
If you include both the --retainPreviousFullBackupCount and --retainPreviousFullBackupAge arguments, then only backups that don't satisfy either condition are deleted.
The remove-backup tool also supports the --retainFullBackupCount and --retainFullBackupAge arguments to delete any backups outside the provided retention criteria.