User Tools

Site Tools


Backup Critical Files

There should be a systematic, programmatic and scheduled backup of files on all Desktops where I work. However, one is not currently in place and given manning and resources, or lack there of, it is unlikely this will be instituted. Thus I devised a method to backup my files to the N: drive and synchronize them on a scheduled basis. I will describe what I'm doing, how I'm doing it and how you can do it below. I caviat all of this with I'm not responsible for your files or what happens to them – caveat emptor.

Backing up your critical files on your Windows Vista/7 should be a seamless and automatic process. To facilitate these criteria I have linked two tools together: Python and the Windows Vista Task Scheduler. I will discuss each in their own section.

The steps you will need to take to get this working for you are:

  1. Ensure Python 2.5 or greater is installed on your PC
  2. Download the (link is below) and put it in a known and usable place on your computer.
  3. Find a secure place to store your backup files, this should be an extra drive in your desktop or the N drive. Storing your backups on the same drive as your originals is not recommended.
  4. Ensure your originals and backups are in folders and match, using diff from is one way to check for differences.
  5. Set up a task schedule in windows to update the files, note the issues discussed in Task Scheduler below. Enable running the task manually and check to see if it works.
  6. Let the process run for a few days to ensure it reliability.


Having some minimal experience in Unix I know of a tool for backing up and synchronizing files called rsync. Duplicating this capability with Python on Windows would require more time than I have and I did not find a relatively simple and understandable solution on the internet. I did find a small script for copying and synchronizing files called The full description and details are at: Verifying and using this approximately 500 line program was relatively easy and I decided to use it with Windows Task Scheduler to implement my process. From the pyrobocopy source code the usage is:

Usage: %s <sourcedir> <targetdir> Options

Main Options:\n
    -d --diff         - Only report difference between sourcedir and targetdir
    -s, --synchronize - Synchronize content between sourcedir and targetdir
    -u, --update      - Update existing content between sourcedir and targetdir

Additional Options:\n
    -p, --purge        - Purge files when synchronizing (does not purge by default).
    -f, --force          - Force copying of files, by trying to change file permissions.
    -n, --nodirection - Update files in source directory from target
                               directory (only updates target from source by default).
    -c, --create        - Create target directory if it does not exist (By default,
                               target directory should exist.)
    -m, --modtime       - Only compare file's modification times for an update (By default,
                              compares source file's creation time also).                   

For my simple use I've only invoked the update and synchronize options. My first step was to copy the file structure and files I wanted; then I used the update function. I did this before setting up a task schedule.

Task Scheduler

The full use of the Windows Task Scheduler is beyond the scope of this document. Below are two links to web sites that provide short “tutorials” on how to use the Task Scheduler.

Once you are familiar with the Task Scheduler there are a couple of tricks and gotchas I've found:

  • Setting up a backup of all of your “critical files” at one time is NOT a good idea. As stated below the synchronization of my e-mail pst is a 1 to 2 min and occasionally a 5 minute process. Updating the files associated with my Python projects takes on order of 5 minuntes. The more files you have the more it will take and the bigger the chance for errors. I recommend splitting the task by folders and or categories.
  • To set up a task using the “Action” is “Start a program” and the “Program/script” is “python.exe.” In my case is used the python at “C:\Python26\python.exe”. Then arguments are source_directory target_directory options. You need to have the full path to each of the directories including where you have stored. For example the argument string I use to backup my python programming files is:
    C:\Users\schiefej\Executables\ “C:\Users\schiefej\WorkLinks\Coding Projects\Eclipse” “N:\WorkLinks\Coding Projects\Eclipse” -u
    Parenthesis must be used if there are spaces in the path.
  • Setting up a program to run at log in is problematic. Desktops can and often are set up with virus scanning and various other updating functions initiating at start up. Network connections also have to be established. I've found the task I have run on log in to synchronize my approximately 1.4 GB e-mail pst file has slowed the initial load of my desktop by 10 mins. Running the task later only takes 1 to 2 minutes. Your mileage may vary.
tools/windows_pseudo_backup.txt · Last modified: 2013/02/13 20:05 by lowcloudnine