@echo off
rem $Id: backup-with-robocopy.cmd 699 2025-01-08 13:25:28Z bertrand $
rem NAME: Fill with the backup name (no spaces, follow filename guidelines)
rem SOURCE: Fill with the full path to the folder from where to get the data
rem DESTINATION: Fill with the full path to the folder where to store the backup
set NAME=
set SOURCE=
set DESTINATION=
if "%NAME%" == "" set NAME=backup-with-robocopy
set FILENAME=Backup_%NAME%.log
echo ROBOCOPY Backup "%NAME%" from "%SOURCE%" to "%DESTINATION%"
if exist %FILENAME%.4 del %FILENAME%.4
if exist %FILENAME%.3 ren %FILENAME%.3 %FILENAME%.4
if exist %FILENAME%.2 ren %FILENAME%.2 %FILENAME%.3
if exist %FILENAME%.1 ren %FILENAME%.1 %FILENAME%.2
if exist %FILENAME% ren %FILENAME% %FILENAME%.1
call .\backup-with-robocopy1.cmd %NAME% %SOURCE% %DESTINATION% 1> %FILENAME% 2>&1
exit /b %ERRORLEVEL%
