• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

Backup Your Important SQL BACKUPS

Started by DJ Garybaldy, October 29, 2022, 03:03:22 PM

DJ Garybaldy

I've just installed Google Drive on my PC and purchased extra space from Google (200GB)

I wish I'd used Google Drive sooner as soon as I take a Backup it whizzes up to Googles servers

I'm also storing my music files up there.

YOU CAN NEVER HAVE TOO MANY BACKUPS! Should the worst happen to your PC


Its why we asked for a database backup tool all those years ago you never know when something might go wrong

Worlds Biggest Fan of RadioDJ

Install MariaDB https://djgarybaldy.blogspot.com/2020/08/installing-maria-db.html

Install RadioDJ: https://djgarybaldy.blogspot.com/2020/08/how-to-install-radiodj-free-radio.html

Into Internet radio for 25 years 1999-2024

RadioDJ 2045 MariaDB 11.2 Windows 11


I have 2 external 2Tb hard drives and 42.000 songs.  Once a day my pc makes an automatic mirror image on the second drive with the free Syncback software.


The backup database folder (c:\RadioDJv2039\Setup\Backup\ )contents a lot of sql backup files.When is set make a daily backup.
To reduce the number of files except for the last backup file, a .bat file can be used.This one looks like this,
@echo off

Call :GetDateTime Year Month Day
set A=%Year%%Month%%Day%

Call :SubtractDate %Year% %Month% %Day% -1 Ret

set b=%Ret%
@echo ###start Deleting
:: variables
Set source=c:\RadioDJv2039\Setup\Backup\

echo ### Deleting up old backup...
DEL /Q /S "%source%\%B%*.*"

:SubtractDate Year Month Day <+/-Days> Ret
::Adapted from DosTips Functions::
setlocal & set a=%4
set "yy=%~1"&set "mm=%~2"&set "dd=%~3"
set /a "yy=10000%yy% %%10000,mm=100%mm% %% 100,dd=100%dd% %% 100"
if %yy% LSS 100 set /a yy+=2000 &rem Adds 2000 to two digit years
set /a JD=dd-32075+1461*(yy+4800+(mm-14)/12)/4+367*(mm-2-(mm-14)/12*12)/12-3*((yy+4900+(mm-14)/12)/100)/4
if %a:~0,1% equ + (set /a JD=%JD%+%a:~1%) else set /a JD=%JD%-%a:~1%
set /a L= %JD%+68569,     N= 4*L/146097, L= L-(146097*N+3)/4, I= 4000*(L+1)/1461001
set /a L= L-1461*I/4+31, J= 80*L/2447,  K= L-2447*J/80,      L= J/11
set /a J= J+2-12*L,      I= 100*(N-49)+I+L
set /a YYYY= I, MM=100+J, DD=100+K
set MM=%MM:~-2% & set DD=%DD:~-2%
set ret=%YYYY: =%%MM: =%%DD: =%
endlocal & set %~5=%ret%
exit /b

:GetDateTime Year Month Day Hour Minute Second
@echo off & setlocal
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
    IF "%~1" NEQ "" set "%~1=%YYYY%"
    IF "%~2" NEQ "" set "%~2=%MM%"
    IF "%~3" NEQ "" set "%~3=%DD%"
    IF "%~4" NEQ "" set "%~4=%HH%"
    IF "%~5" NEQ "" set "%~5=%Min%"
    IF "%~6" NEQ "" set "%~6=%Sec%"
exit /b

Hoop this will help you.
I call the file remove old sql backups.bat
attach ment is called remove old sql backups.txtchange .txt in .bat.

R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs ( ͡° ͜ʖ ͡°)
The Radiodj tutorials site is now managed by Domstad radio .nl still  Just in English