Friday, August 21, 2009


This is a simple utility which people working on a lot of data everyday may find quite useful. Once when I had just started coding professionally, I had the misfortune of losing some code due to a hard drive crash. Since then, me and my team members started following the routine of backing up the days' code to the shared drive (network attached storage) as committing un-reviewed stuff to version control was not desirable. Doing this thing manually everyday was something I disliked. Besides, people (including me [:)]) used to forget it on most days. So, I thought of automating this with a simple Java project.

The BackItUp project which has a single Java file can be downloaded here.

The program accepts two command line input arguments, namely the directory/ file to be backed up and the path of the zip file (including its name) to which the contents need to be saved to. It uses classes from the Java I/O package for the file operations. After downloading and unzipping the project, open the run-program.bat and modify the paths succeeding the class name to point to ones you require. The first path points to the directory/ file to be backed up and the second is that of the zip file ending with its name. If the file path contains spaces, remember to surround it with quotes as Java reads a space as an argument separator. A pre-requisite for the program to run successfully is that JDK or JRE's bin should be added to the Windows PATH variable.

To automate the process of running the program when required, create a Windows scheduled task and associate it with the run-program.bat file. Creation of scheduled task is described in detail here.

1 comment: