Monday, February 9, 2009

Backup data using WinRAR

WinRAR has become a standard for compression of data. This program has a core utility running on its back, that is the Rar.exe file, this is the executable program running behind the user interface. This file can be easily located in its installation directoty like:

C:\Program Files\WinRAR\

In this directory you will also find a Rar.txt file, this file contains all the command options Rar.exe program takes to perform different operations.

I developed a routine to backup my data using it as follows:

1. We create a text file named "mybackup.txt", in this file we enter all the directories or files for which backup is required. This file is filled as follows:

C:\Documents and Settings\<User Name>\My Documents\
C:\Documents and Settings\<User Name>\Desktop\

And save this text file in the same directory where Rar.exe program is located, i am doing this to avoid path errors.

2. We create a batch file, in this file we will call the Rar.exe program and pass it required parameters to backup my data as follows:

rar.exe -r u D:\mybackup.rar @mybackup.txt

[-r]
This indicates that all files and sub directories should be included

[u]
This indicates to update archive, if archive mybackup.rar already exists than update files in it and add new files

[D:\mybackup.rar]
This is the location and name of archive file

[@mybackup.txt]
This is the name of list file from which Rar.exe program will find directories and files you want to backup

We will save this batch file it the same location where Rar.exe program is located.

That’s all the backup routine using WinRar is ready, the best part of this backup routine is its ability to check a file if it has been modified, if a file is modified than and only than it is added to archive, this reduces overall backup time for subsequent backups. The backup routine will take time when executed first time, after that all subsequent backup operations will be faster as it will backup only modified files.

No comments:

Post a Comment