sábado, 11 de junio de 2011

Simple scripts for Backup in Windows using MSDOS

Not long ago I was reviewing [and cleaning] my files from my PC, in the process I review the files and move them to another location supposedly easiest to remember and access. About a month after the process and after updating all my backups I realize I lost about 1GB of information form an old project. It might not been a big issue because it was more than 2 years old information but it was a lost after all.

A couple of months later I was working in a presentation for a project that has daily changes. One day I tried to go back a couple of versions but I was unable to get the one I want. At that time, and still now, my versioning was a number at the end of the file’s name, but it is not a reliable process.

I came to the conclusion that I needed a sort of daily incremental backup process, to keep track of my files.

I started reviewing backup software but besides the cost, most of them requires an external device, installation and are like black boxes for end users.

As I like challenges, I start my own backup project with these premises.

It needs to:
  • Backup all files (full backup)
  • Backup only changed files (incremental backup)
  • Restore the newest file from backup (given the name)
  • Restore any version of a file from backup history (given the name)
  • Restore all files from backup (the newest of each file)
  • Use local disks or external devices (attaches to the PC and as named disks)
  • Compress the backup files to save space
  • Only backup data files

My PC is configured with 2 partitions, C for Windows OS and D for all my data. The intention for the backup is to cover only my data files. The final product might be used to backup system files also but those won’t work for a full OS recovering.

Starting with the compression requirement, I made tests for compression using WinRAR, and thanks to RARLAB for this great software. Part of the functionality of WinRAR is a king ob Backup system.

Exploiting WinRAR Functionality and its command line version, I made the next scripts to accomplish my requirements...

The final solution includes these files:
  • BackupConfig.cmd
  • Backup.cmd
  • ListBackup.cmd
  • RestoreNewest.cmd
  • RestoreAll.cmd
  • FullRestore.cmd

Next, we will talk about the functionality.

No hay comentarios: