Portable backup solution for Windows

I have been thinking about creating an easy solution to backup some files from different computers to thumb drives. I wanted a solution that was portable (so I could run it from the thumb drive) and easy to configure (maximum update one path to copy from and one to copy to).

I decided to give Robocopy (that I use for complete backups) a try. The portable requirement was solved by copying the file Robocopy.exe from the folder C:WindowsSystem32 (in Windows Vista) to my thumb drive. And the easy to configure requirement was solved by creating a Backup.bat file on the thumb drive with the following content:

SET source="D:Code"
SET destination="./CodeBackup"
SET logfile="./Backuplog.log"

SET copyMode=/MIR /XF desktop.ini
SET options=/R:0 /W:0 /LOG+:%logfile% /NFL /NDL

Robocopy.exe %source% %destination% %copyMode% %options%

It copies the folder Code from my D: drive to the folder CodeBackup in the root folder on the thumb drive.

I popped out the thumb drive and stuck it in a Windows XP computer that didn’t have Robocopy installed. I ran the bat file and it didn’t work. It seems like you need to have different versions of Robocopy for it to run in Vista and XP so I downloaded the Windows Server 2003 Resource Kit which includes a Robocopy version that workes in XP. To be able to run robocopy on both Vista and XP I renamed the files to RobocopyXP32.exe and RobocopyVista32.exe. Then I updated the Backup.bat file to point to the XP version when I’m doing the backups from XP and the Vista version when doing backups from Vista. It seems to work fine and is an easy enough solution!

Vista and Incremental backups

I usually use Rsync for my incremental backups but since I moved to Vista it’s a bit of pain to get it working. I tried to install it using both Cygwin and DeltaCopy but couldn’t get it to copy international chars (i.e. åäö) via either Samba or SSH. So I looked into a tool called robocopy which is included in Vista (you can get it for XP as well). It worked fine and was easy to use.

To mirror a folder from one folder to another I put the following to a bat file (all on one row):

robocopy "D:Pictures"
"MyOtherComputerBackupPictures" /MIR

I did some different bat files for all folders I wanted to backup. At last I created one bat file that calls all the other. It looks like:

call BackupPictures.bat
call BackupCode.bat

There are loads of settings to customize your backups. For example to avoid copying desktop.ini files add /XF desktop.ini just after /MIR in the above example. Look into the robocopy help for more configuration options.