MySQL backup CGI script question

Hello Everyone;
Script file: /usr/libexec/webmin/mysql/backup_db.cgi working just find and do all job needed, but can it modified to backup all databases in more then one version.
I made it scheduled hourly and when it run every hour it over wright the existing, i need to backup hourly with more then one version say add
$(date +%F) = YYYY-MM-DD
if it possible.
Regards

This thread may help.

https://www.virtualmin.com/node/54190

Hello noisemarine,
Thanks for this one, actually since i need it to backup databases every hour i have modified the DATE variable to be: date +%F-%H EX: (2017-11-01-11).
This assuming will create 24 folders per day (1 folder per hour).
Now i need a script that takes a backup of a new week and remove the backup of the previous week.
EX: New backup will be taken from day 8 to day 14, and old backup will be removed (from day 1 to day 7) and so on.
Thanks

i have mange it by adding this:
find /backup/path -maxdepth 1 -type d -mtime +7 -exec rm -rf {} ;