@echo off
:: Dad's backup.bat to copy My Documents, Mail/Addressbook and IE Favorites to a USB HDD
::
:: variables
set drive=F:\BACKUP
set backupcmd=xcopy /e /d /h /i /r /y /q
set hour=%time:~0,2%
if "%hour:~0,1%"==" " set hour=0%time:~1,1%
set folder=%date:~10,4%_%date:~4,2%_%date:~7,2%_%hour%_%time:~3,2%
cls
echo Connect the external Hard Drive to computer and power
echo and check that the power switch is ON.
pause
:: simple check to see if backup folder is present
IF NOT EXIST %drive% GOTO :DRIVEERROR
IF EXIST %drive% GOTO :BACKUP
:BACKUP
echo ### Backing up Thunderbird Mail and Address Book folders...
%backupcmd% "%USERPROFILE%\Application Data\Thunderbird\Profiles" "%drive%\Thunderbird\%folder%"
echo ### Backing up My Documents...
%backupcmd% "D:\My Documents" "%drive%\My Documents\%folder%"
echo ### Backing up Internet Explorer Favorites...
%backupcmd% "%USERPROFILE%\Favorites" "%drive%\Favorites\%folder%"
echo.
echo BACKUP COMPLETE !!!
@pause
GOTO END
:DRIVEERROR
cls
echo MISSING BACKUP DRIVE !!! MAKE SURE DRIVE IS CONNECTED AND READY
echo AND DOUBLE CLICK THE ICON AGAIN. IF PROBLEM PERSISTS CONTACT ME
pause
:END