The support forum

Dynamically adjusting the backup path

Aug 03, 2018

Overview


As of Release 79.6 it is possible to dynamically modify the path of backup folder based on the current date, time or run number.

*  For older versions see there's another (far less pretty) way to do this -  
    https://bvckup2.com/support/forum/topic/716

This can be used to automatically direct the backup to a different folder depending on the time of day, day of the month, etc., and ultimately provide a form of backup snapshots in an easy manner.

For example, setting "Backup To" to

        X:\Backup\%HOUR%

will direct backups to

        X:\Backup\00 between 12 am and 1 am
        X:\Backup\01 between 1 am and 2 am
        X:\Backup\02 between 2 am and 3 am
       ...

Here it is in action - https://bvckup2.com/wip/02082018

Date & time


        %YEAR%                  -  4 digit year, e.g. 2018
        %MONTH%             -  2 digit month, starting with 01 for January
        %DAY%                    -  2 digit day, starting with 01

        %DATE%                  -  a combination of  %YEAR%-%MONTH%-%DAY%

        %HOUR%                 -  2 digit hour, 00 through 23
        %MINUTE%              -  2 digit minute, 00 through 59
        %SECOND%             -  2 digit minute, 00 through 59

        %WEEK%                  -  2 digit week of the year, starting with 01

        %DAY_OF_YEAR%    -  3 digit day of the year, with 001 for Jan 01
        %DAY_OF_WEEK%   -  2 digit day of the week, with 01 for Monday

        %DOW%                    -  short name of the day, i.e. Mon, Tue, Wed, ...

Backup run number


        %RUN%  -  current backup run number, starting with 1 and going
                            up in 1 increments with every backup attempt

Additionally, the following form can be used to cycle this variable through numbers from 1 to N:

        %RUN#N%

For example, %RUN#3% will start with 1, 2, 3 and then go back to 1.

Furthermore, starting with release 81.12 the following form will cycle through the numbers _and_ also left-pad smaller ones with zeroes to keep the digit number the same:

        %RUN|N%

For example, %RUN|183 will produce 001, 002 ... 099, 100 ... 183, 001 ...

This is useful for the case when you need to keep N last copies of the whole backup set; and the second form allows for folder names that _naturally_ sort from 1 to N.

Caveats


1. When the backup destination switches to a new folder, it will invalidate destination snapshot and require a full destination rescan.

2. Similarly, this will also invalidate delta copying state, so actively modified files will end up being recopied in full on their next update.

To put differently, the engine does NOT keep a separate delta state and destination snapshot for each destination.

Aug 03, 2018

Daily backups with a week worth of history


Set your backup path to end with %DAY_OF_WEEK%

For example, X:\Backup\%DAY_OF_WEEK% will back things up into X:\Backup\01 on Mondays, X:\Backup\02 on Tuesdays, etc.

Aug 03, 2018

Daily backups, each in its own folder


Set your backup path to end with %DATE%

For example, X:\Backup\%DATE% will back things up into
X:\Backup\2018-08-03 today, X:\Backup\2018-08-04 - tomorrow, etc.

*  Obviously, this will keep eating up disk space, so you will need to take care of deleting older backups as needed.

Aug 03, 2018

Cycling through a set of N backup folders, one per run


Set your backup path to end with %RUN#N%, whereby "N" is a number.

For example, X:\Backup\%RUN#4% will cycle through

        X:\Backup\1
        X:\Backup\2
        X:\Backup\3
        X:\Backup\4

Arbie :

Jan 24, 2021

In the final example I think you meant %RUN#4%, not %RUN.4%.

Also, it would be nice if the counter was zero-filled so that %RUN#30% would give
...
X:\Backup\09
X:\Backup\10
instead of
X:\Backup\9
X:\Backup\10
since the former will always sort predictably.

Arbie :

Jan 25, 2021

Also something odd.  I set up two RUN jobs, each with a different source, different count, and different destination.  I tested the first one a couple of times.  On my first test of the second job (%RUN#7%) it created folder "3" - not "1" as I expected.

So I'm wondering if the RUN variable is being kept separate between jobs, or somehow got mixed up?

Dynamic destinations is a great feature which I'm very glad you added.

Thanks!

Alex Pankratov :

Jan 25, 2021

In the final example I think you meant %RUN#4%, not %RUN.4%.


Fixed, thanks.

Also, it would be nice if the counter was zero-filled


Indeed. I can't change how RUN# works, but I can always add another expression. Will do in the next release.

So I'm wondering if the RUN variable is being kept separate between jobs, or somehow got mixed up?


They _are_ per job, but they are based on a backup run counter that starts with the first job run. It's the one reported here -

    2021.01.20 10:03:13   Running the backup...
    2021.01.20 10:03:13       Preparing...
    2021.01.20 10:03:13           Run number: 5

New topic

Create
Made by IO Bureau in Switzerland
Support

Updates Newsletter
Blog & RSS
Follow Twitter
Reddit
Miscellanea Press kit
Testimonials
Company Imprint

Legal Terms
Privacy