There are likely thousands of ways to backup your computers data. One I like, since it is simple, is using a batch file that calls 7zip to create a zip backup with the current date embedded in the zip file name.

This method can be described as “so 1980’s” since it is done with batch or command files calling batch programs with command line parameters.

Side Note: This article was written in 2008 so some of the references may be out-of-date.

You need working copies of Ruby and 7zip installed. Both products are open-source and free.

The first piece of the puzzle is a short ruby script that does nothing more than create a one-line batch file to set an environment variable with a formatted date string for today.

#!/usr/bin/ruby -w
time =
yymmdd = time.strftime('%Y-%m-%d')
myfile ="yymmdd.bat", "w+")
myfile.puts("SET YYMMDD=#{yymmdd}")
puts "Set YYMMDM to #{yymmdd}"

Save this script as “set-yymmdd.rb”.

Run this script and you will get a new file “yymmdd.bat” that looks like this.

SET YYMMDD=2010-02-25

If you do not understand how environment variables work in Windows command processing, you can read up on in many web sources including these articles at Microsoft Support and Wikipedia

Now the magic that pulls it all together is the final batch command script

set indir="c:\PersonalApps\*.*"
set otdir=q:\backups\
set otfil=Personal
call set-yymmdd.rb
call "C:\Program Files\7-Zip\7z.exe" a -r -tzip "%otdir%%otfil% %YYMMDD%" %indir%

In this case “c:\PersonalApps*.*” is a directory on my computer that I want backed up. The backup is being written to a network drive that I have permanently mapped to my Q drive and it has an existing “\backups” subdirectory. The backup itself gets named “Personal” since I ran it on February 25th of 2010.

The current date is a part of the file name so backups done on other days will have unique names and will not accidentally overwrite.

In my case, I keep a folder on my desktop with icons to run the various backups when I want.

You could just as easily set up any scheduler program, including Windows built-in ability to run scheduled tasks, to make your backups run automatically.