Simple Backup Script

This is a simple backup script using a batch file, it writes to a log file, sends the log file by email and then renames the log file by date and time.

@echo off
Rem This line outputs the start time to the log
echo ***************************************** >> c:\batch\nasbackup.log
echo Org-Nas Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo ***************************************** >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (APPS) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy c:\apps\*.* /s /d /y /e /h e:\apps\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (CHEL Archive) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\cHEL Archive\*.*” /s /d /y /e /h e:\chel_archive\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (DATA Archive) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\Data Archive\*.*” /s /d /y /e /h e:\data_archive\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (DIRECTORS Archive) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\Directors Archive\*.*” /s /d /y /e /h e:\directors_archive\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (Group Bid Management) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\Group Bid Management\*.*” /s /d /y /e /h e:\Group_Bid_Management\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (IT Share) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\IT Share\*.*” /s /d /y /e /h e:\IT_Share\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (Mail Archive) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\Mail Archive\*.*” /s /d /y /e /h e:\Mail_Archive\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (Patches) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\Patches\*.*” /s /d /y /e /h e:\Patches\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

rem echo Org-Nas (PSTArchive) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
rem echo. >> c:\batch\nasbackup.log
rem xcopy “c:\PSTArchive\*.*” /s /d /y /e /h e:\PSTArchive\ >> c:\batch\nasbackup.log
rem echo. >> c:\batch\nasbackup.log
rem echo. >> c:\batch\nasbackup.log

echo Org-Nas (Removed Users Archive Mailboxes) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\Removed Users Archive Mailboxes\*.*” /s /d /y /e /h e:\Removed Users Archive Mailboxes\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (Software) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy “c:\software\*.*” /s /d /y /e /h e:\Software\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

echo Org-Nas (Users Archive) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
xcopy c:\users_archive\*.* /s /d /y /e /h e:\users_archive\ >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log
echo. >> c:\batch\nasbackup.log

rem echo Org-Nas (Virtual Machines) Backup Started at %time% – %date% >> c:\batch\nasbackup.log
rem echo. >> c:\batch\nasbackup.log
rem xcopy “c:\Virtual Machines\*.*” /s /d /y /e /h e:\Virtual Machines\ >> c:\batch\nasbackup.log
rem echo. >> c:\batch\nasbackup.log
rem echo. >> c:\batch\nasbackup.log
echo Org-Nas Backup Completed %time% – %date% >> c:\batch\nasbackup.log
goto email

:email
blat nasbackup.log -to email@address -subject “Nas USB Caddy Backup” -server smtp.serveraddress -f from@emailaddress
goto rename

:rename
rents nasbackup.log /d=”dd mm yyy hhmm”