Simple Backup script (mid to long term)

Call the script “backup_manual.cmd” and run it once a week, once a term or once a year if you like.  It will save data in a ‘year’ folder i.e. “2015” which will be overwritten each time the script is run.  The next year, it will start overwriting next year’s folder.

Note: You will need sufficient free space on your USB hard disk as each year a new backup set is created.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: If site uses multiple HDDs for backup rotation:           ::
::   - only connect one HDD at a time to retain drive letters::
::   - make sure they all are assigned the same drive letter ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off
SETLOCAL

::::::::::::::::::::
:: Site Variables ::
::::::::::::::::::::

set usb=F:
set year=%date:~10,4%
set dest=%usb%\Backup\%year%
set switches=/E /NP /NFL /tee /R:1 /W:1 /MIR /COPYALL
set robocopy=%windir%\system32\robocopy.exe

::::::::::::::::::::
:: Initialization ::
::::::::::::::::::::

if not exist "%usb%"  exit
if not exist "%dest%" md "%dest%"

:::::::::::::
:: Backup  ::
:::::::::::::

"%robocopy%" "c:\folder1" "%dest%\folder1" %switches% /LOG:"%dest%\backup_folder1.log"
"%robocopy%" "c:\folder2" "%dest%\folder2" %switches% /LOG:"%dest%\backup_folder2.log"
"%robocopy%" "c:\folder3" "%dest%\folder3" %switches% /LOG:"%dest%\backup_folder3.log"

:End
ENDLOCAL
:Exit
Simple Backup script (mid to long term) was last modified: March 18th, 2015 by tabcom