REM *** Schedule this batch file to run daily using the Windows scheduled tasks utility REM *** The most recent backup file will end with the number 1 REM *** Older backup copies will end with 2,3,4, etc. up to [MaxBackups] REM *** Set the following paths to match your environment and preferences SET BackupPath="C:\Backup" SET GBAKPath="C:\Program Files\Firebird\bin\gbak" SET DBPath="C:\KZSoftware\VEHICLEDATA.VDB" SET DBName=VehicleManager SET MaxBackups=10 REM *** Create the backup folder if it doesn't already exist: IF NOT EXIST %BackupPath% MKDIR %BackupPath% REM *** Delete the oldest backup file if exist %BackupPath%\%DBName%%MaxBackups%.vbk del %BackupPath%\%DBName%%MaxBackups%.vbk REM *** Rename the remaining backup files to the next position :BEGINLOOP SET /a B=%MaxBackups%-1 if exist %BackupPath%\%DBName%%B%.vbk ren %BackupPath%\%DBName%%B%.vbk %DBName%%MaxBackups%.vbk SET /a MaxBackups=%MaxBackups%-1 IF %MaxBackups%==1 GOTO ENDLOOP GOTO BEGINLOOP :ENDLOOP REM *** Backup the Firebird database %GBAKPath% -b -v -t -user SYSDBA -password masterkey LOCALHOST:%DBName% %BackupPath%\%DBName%1.vbk REM END SCRIPT