Modified: 05th Jun 16 |

Backup and Recovery Archive Generator

0.1.0, July 8th, 2014
Copyright © 2014 Daniel Korsgaard, Freeware
Download: mirror [about 1 MB] mirror [about 1.2 MB]


For a very long time I have been pondering how to make the ultimate backup solution. Can't say that I achieved the "ultimate" yet, but I've certainly gotten closer than ever.

The primay goals of this thing is:

  • Incremental backups.
  • Zero maintenance.
  • No imposed path length limitations.
  • Insanely fast directory scanning.
  • Extremely flexible file filtering.
  • Easy access to backup data.
  • Easy access to backup data.

Some distinct non-goals are:

  • Low bandwidth network backup.
  • Internet/cloud/remote backup.
  • *nix support.

How does it work?

If you donwload the .zip-file above, you will notice that there are some help files in there, they will guide you through the setup of BRAG.

Basically, you have one configuration file that describes everything to make a backup from one folder to a different folder. The following sections gives an idea of what can be configured, and how it works.


There are four modes of operation:

  • Full
  • Incremental
  • Windowing
  • Rolling

In "Full" mode, all files selected for backup, will all be put into the same set of archives, regardless of any prior backups.

The "Incremental" mode will take into account that some files in the source directory might not have changed since the last backup. BRAG creates index files in its destination dir, to make very fast judgmenets on wether or not some file has been changed. All the files where the modification time and filesize matches, will not be backed up. Checking the content on disk, will be a feature for a later version.

The two remaining modes are both meant for protecting against filling up the disk. They will be described here once they are actually implemented.

Dir Selection

The first pass of choosing which files to backup, is to filter which subdirectories in the source, to either exclude from further scanning, or include for further scanning. You have the ability to select the directories based on regular expressions (like "^[^/]+/\.svn/.+$") and familiar file patterns (like "users/*"). And you can combine your individual patterns with logical expressions like "and", "or", and "not".

Whatever directories that havent been excluded by the dir selector will undergo scanning for files.

File Selection

File selection works exactly the same as dir selection, but you have the ability to also incorporate things like filesize, and modification time as well, to filter which files are supposed to be backed up.

You should downlaod the package and see the configuration file, if you want to see how this works in detail.

Format Selection

Once all the files has been determined, you have the option of telling exactly how the files are supposed to be processed, and which of the files are going to be processed in particular ways. An example could be to decide that all your .jpeg-files should be left uncompressed, and merely be copied over to the destniation folder as plain files. but at the same time, you want all your text files to be processed by some special archiver that excels at compressing text.

You have the option to get the files processed by any tool that can be called from the commandline, the only requirements are that your tool speaks unicode, and that it can accept a listfile as input. And further, it must be capable of telling exactly which files it has processed, otherwise it is impossible for BRAG to actually verify that files have indeed been backed up.

Simple Configuration Example

The simplest configuration where there is no dir nor file filtering of any kind is as follows.

  1. #### Simplest BRAG config file ####
  2. source_dir("C:/Users")
  3. destination_dir("D:/Backups/Users")
  5. mode(incremental(0))
  7. select_dirs(
  8.     include()
  9. )
  11. select_files(
  12.     include()
  13. )
  15. select_format(
  16.         format("7z")
  17. )
  19. format_specification(
  20.         "7z"
  21.         ,archive(
  22.                 executable("C:/Program Files/7-Zip/7z.exe")
  23.                 ,arguments("a -ssw -mx1 -ms=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -scsUTF-8 -sccUTF-8 ""%archive%"" @""%listfile%""")
  24.                 ,workdir("%srcdir%/")
  25.         )
  26.         ,verify(
  27.                 executable("C:/Program Files/7-Zip/7z.exe")
  28.                 ,arguments("l -scsUTF-8 -sccUTF-8 ""%archive%""")
  29.                 ,filepattern("^(\d.{18})\s(.{5})\s([ 0-9]{12})\s([ 0-9]{12})\s\s(.*)$", 5)
  30.         )
  31. )
  33. # End