Sandip's Programming Zen

An attempt to share tech/coding experiences

Posts Tagged ‘backup utility

Batch file Backup Utility

leave a comment »

For long I have been using a simple batch file to keep backup of important content on my PC. It is a very simple & flexible solution and you don’t have to install anything. However, the batch file is using a command line compressing utility called FBZIP you can download it from here, which you have to keep along with batch file.

You can run the bath file manually or schedule it according to your backup strategy

Following is the code for batch file.

@echo off

:: variables

set backup_drive=D:\Backup

set backupcmd=xcopy /s /c /d:12-31-2007 /e /h /i /r /y

set Fbackupcmd=xcopy /s /c /e /h /i /r /y


echo ### Backing up Desktop contents…

%backupcmd% “C:\Documents and Settings\…\Desktop” “%backup_drive%\Desktop”

echo ### Backing up My Docs

%Fbackupcmd% “C:\Documents and Settings\…..\My Documents” “%backup_drive%\MyDocs”

echo ### Compressing Backup Folder…

fbzip.exe -a -p -r “%backup_drive%\Backup_%date:~-4,4%%date:~-7,2%%date:~0,” “%backup_drive%”

echo Backup Complete!


In following line, date is used to check differences of target and destination folders only after specified date.
set backupcmd=xcopy /s /c /d:12-31-2007 /e /h /i /r /y

If you want to keep it simple then remove the date part (as follows), it will just check all differences regardless of date stamp.

set backupcmd=xcopy /s /c /d /e /h /i /r /y

Written by Sandip

January 30, 2008 at 10:22 am