How the backup retention works:
When a backup job finishes successfully, it goes over the ‘Last Modified’ date on each of the sub-folders under the backup destination folder. It calculates the time passed from the time stamp to the current time. If there are any backup folders with this calculated time longer than the configured ‘retention period’, the process will delete them.
Why does my backup retention fail to delete old backups?
When configuring a backup retention for 168 hours (7 days) and configuring the build to run every week, the old backup might not get deleted when the new backup completes successfully.
Because of this, the reason why the old backup was not being deleted is because the older backup job finished (and edited the last modified value of the folder) less than 168 hours before the newer backup job was done. You can look this up in your filesystem, if your previous backup folder’s ‘last modified’ date is less than 168 hours from the newer backup modified date, this would explain why the backup was not deleted.
In order to make sure the backup is deleted every week, you should configure the retention period to a value that is reasonably lower than 168 hours (i.e: 160 hours).