A backup script using WinRAR

Hi all,

I’m using a backup-script (DOS batch-file) which I run at the end of the month to backup my knowledge documents for my work. For this I use the command line version of WinRAR (which comes automatically with a graphic install of WinRAR).

The batch-file itself contains the following lines:
1) The rar-executable call:

  • which for ‘a’ adds the files
  • -p adds a chosen password (no space between -p and your password)
  • -r recursively (for deep nested file structures)
  • the destination WinRAR-filename
  • source location (recursively !)

rar.exe a -p<INSERT PASSWORD HERE> -r backup.rar D:\Data\Backups\DATA\*.*

“C:\Program Files\WinRAR\rar.exe” a -r “D:\backup.rar” “D:\Google\*.*”

2) Perform actions on the resulting filename:
for /f "tokens=1-5 delims=: " %%p in ("%time%") do set time="%%pu%%q"
for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "backup.rar" "backup_%%f-%%e-%%d_%time%.rar"

Which then results in the following unique WinRAR-filename:
backup_2013-07-31_10u19.rar

Of course you can use a freeware scheduling utility to auto execute this script at the end of each month.
Eg. Freebyte Task Scheduler (just googled this! Did not test this myself but it should do the job)

Source : http://www.thecoolestdolphin.be/?p=592

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s