The backup tool can be used with either the --retainPreviousFullBackupCount or --retainPreviousFullBackupAge arguments to identify which previous backups should be preserved. Any other backups in that directory will be removed. A new backup will always be preserved. If the new backup is an incremental backup, then any other backups it depends on will also be preserved. However, older backups in the same directory are eligible to be removed.

If the --retainPreviousFullBackupCount argument is provided, that number of the most recent previous full backups will be preserved (along with any incremental backups that depend on them). Any other previous full backups (and their dependent incremental backups) can be removed. If the --retainPreviousFullBackupAge argument is provided, 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 will be eligible to be removed. If both the --retainPreviousFullBackupCount and --retainPreviousFullBackupAge arguments are provided, then only backups that don't satisfy either condition will be deleted. 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 will be removed.

Note: The remove-backup tool also supports the --retainFullBackupCount and --retainFullBackupAge arguments to delete any backups outside the provided retention criteria.