Friday 17 June 2011

Script Backup

Backup folders/ files to network share using simple DOS command.
(save money by purchasing softwares which can do the below process)
so here we go:
simple xcopy command needs to be created on a bat file so that the .bat can be automated by windows scheduler.
for eg:
xcopy "D:\GP Backup\SQL Svr Bkp\09" \\qdc-gp\Backup /E /R /Y /D /Q
the above command says to copy everything (files and folders) under 09 directory to a network path under folder Backup. make sure you follow the syntax and the path should be specified within "" so that any spaces in between will be taken care of. 
/E stands for .. Copies directories and subdirectories, including empty ones
/R stands for .. Overwrites read-only files
/Y stands for .. Suppresses prompting to confirm you want to overwrite an existing destination file.
/D stands for .. If no date is given, copies only those files whose source time is newer than the destination time. if you want a specify date, provide in /D:m-d-y format.
/Q stands for .. Does not display file names while copying.


Make sure that the destination share folder has write permission to the account with which the batch file will be executed.
you may apply the above command which are legitimate form your perspective.


xcopy /? will give you the syntax and the relavent usage of switches
Interesting part is scheduling the batch file and alerting the concerned staff with an automated email after the backup completes.

0 comments: