Steps to reproduce:
1. In "Automated backup setup": set backup_auto_active to "Manual"; set backup_auto_storage to "Specified directory for automated backups"; set a valid path for "backup_auto_destination"; set backup_auto_keep to 1; tick "backup_shortname"
2. From the cli, run /admin/cli/automated_backups.php to generate backup files
3. Run it a second time
Only one copy of the course backup file should be kept.
Two backup files for each course now exist.
Line 504 of /backup/util/helper/backup_cron_helper.class.php is:
This is used to build a regular expression to match old copies of the backup files. But if you are using course->shortname instead of course->id in the filename, it cannot match the file, so it remains on the filesystem.
The workaround is to unset "backup_shortname", but this makes identifying your course backup files more difficult.