This is for you, Bigsofty :-)
Keeps backups to as many generations as you want. Just change the variable "backups" to how many backups you want. I hope this works for you too, seems to work well enough for me so far but isn't overly tested since it was a 30 min job before bed... :-)
It will create a subdirectory in your project folder called "backups" and in this one there will be even more subfolders, as many as you specify in the variable. The highest number will always be filled with the latest backup, all others move one step down for each backup-run. 5 becomes 4 and so on. It's done with the move command so should be almost instant no matter how many files are in those folders.
Put this on a macro and call it before every compile. Would be handy with a macro that always runs automaticly before and after a compile. I thought there was such a thing but I can't find it?
:: Manage backups
:: By Moru
:: http://gamecorner.110mb.com
:: ---------------------------
:: How many backups do you want:
SET backups=7
:: Create the folders
FOR /l %%x IN (1, 1, %backups%) DO IF NOT EXIST "%GLB_PROJ_PATH%\backups\%%x" MKDIR "%GLB_PROJ_PATH%\backups\%%x"
:: Remove first
RMDIR /S "%GLB_PROJ_PATH%\backups\1" /Q
:: Rename the rest to replace the first moving the backups one point down the ladder
FOR /l %%x IN (2, 1, %backups%) DO CALL :do_move %%x
:: Create the last folder again
IF NOT EXIST "%GLB_PROJ_PATH%\backups\%backups%" MKDIR "%GLB_PROJ_PATH%\backups\%backups%"
:: Copy all sourcefiles to this last folder
:: change .gbas to "*" if you want backup of all files, not just the .gbas
:: add /S to copy subfolders too (this will make it a lot slower but keep backup of the exe-file and all media too)
:: Add /A to only copy changed files. I don't recommend this since it will move out the file from the backup-set sooner or later and there won't be more backups of this file)
XCOPY "%GLB_PROJ_PATH%\*.gbas" "%GLB_PROJ_PATH%\backups\%backups%" /Q
EXIT
EXIT
:: -------------------------
:: Do the moving of a folder
:: -------------------------
:do_move
:: The ID of the target folder (move each folder down one step, 2 becomes 1)
SET /a ny=%1-1
MOVE "%GLB_PROJ_PATH%\backups\%1" "%GLB_PROJ_PATH%\backups\%ny%"
GOTO :EOF