Auto-Incrementing Variable
Author: Swapna Naraharisetty, 2BrightSparks Pte. Ltd.
The auto-incrementing variable (%AUTOINC%) is a special variable that was introduced in SyncBackPro/SE V10.2.4.0. It is not available in SyncBackFree or older versions of SyncBackPro/SE. The AUTOINC variable automatically increments every time a profile is run, which you can use to customize your backups (e.g. to create 10 backups of your data).
The current value of the variable is increased by 1 at the end of each profile run. The range of values ([min, max] values) the variable can hold are defined in your profile configuration. If the variable goes over the maximum value then it is automatically reset to the minimum value. For example, if you set the minimum value to 1 and maximum value to 10, then %AUTOINC% variable has values from [1 to 10]. If the value exceeds 10, then it is reset to 1.
How to use the AUTOINC variable
- Modify your profile and go to the Variables > Incremental settings page
- Tick the checkbox Enable the auto-incrementing variable
- Specify the Current value, Minimum value, and Maximum value. The current value cannot be less than the minimum value or greater than the maximum value. The minimum value cannot be less than zero or greater than the maximum value. The maximum value cannot be less than the minimum value.
- If you require, you can enable the options Increment if restore, Increment if simulated run and Increment if profile is aborted. If these options are enabled, then the variable is incremented even if the profile is run as a restore, simulated run or when the profile is aborted. By default, the options are not enabled.
- Do not forget to actually use the variable in your profile, e.g. in your Destination path
Examples
In this section, we will give a few use-cases for the AUTOINC variable.
Multiple Backups
For this example, we will create a Backup Profile and use %AUTOINC% variable to keep 10 backups of your data on a Destination device.
Create a Backup/Mirror profile and configure your source as appropriate (on the Simple settings page)
Set the Destination (your backup destination path) to something like X:\Backups\%AUTOINC%\ (so that SyncBack can copy files to a different directory in each run)
Go to the Variables > Incremental settings page
Tick the checkbox Enable the auto-incrementing variable
Set the Current value and Minimum value to 1 and the Maximum value to 10. Of course if you want fewer, or more, backups then change the 10 as appropriate.
Leave the options Increment if restore, Increment if simulated run and Increment if profile is aborted unchecked
Save the settings. You can now schedule the profile or manually run the profile. Each time it is run it will backup to a different folder.
For the first run, the files are copied to X:\My Backups\1\ and the next run to X:\My Backups\2\ and so on. On the 10th run, after copying files to X:\My Backups\10\, SyncBack will reset the AUTOINC variable to 1 for the next run.
Incremental/Differential Backups
Together with Fast Backup, you can use the AUTOINC variable to create a Full Backup with as many Incremental/Differential backups as you need.
For this example, we will create a Fast Backup profile and use the %AUTOINC% variable to keep one Full Backup and six Incremental/Differential backups on the Destination drive. SyncBack will perform a full backup when the AUTOINC variable value is 1 and Incremental/Differential backups for the remaining values.
Create a Backup/Mirror profile and configure your source as appropriate (on the Simple settings page)
Set the Destination to something like X:\%AUTOINC%\ (so that SyncBack can copy incremental/differential data to a different directory in each run)
Go to the Variables > Incremental settings page
Tick the option Enable the auto-incrementing variable
Set the Current value and Minimum value to 1 and Maximum value to 7. Leave the options Increment if restore, Increment if simulated run and Increment if profile is aborted unchecked.
Go to the Fast Backup settings page and select the option Perform a Fast Backup
Tick the option Delete all the files and folders on Destination before the backup
If you want SyncBack to create Differential backups (instead of Incremental), then tick the option Differential backup (do not update the fast backup data) (along with the option Delete all the files and folders on Destination before the backup)
Enable Use a different folder for full (rescan) backups and set the full backup folder to X:\1\. This is to allow SyncBack to copy full backup data to a separate directory on destination.
In the Force a re-scan when: box select the %AUTOINC% item
Select Equals from the drop-down on the right and enter 1 in the edit box below the drop-down list (so that SyncBack creates full backup when the variable value is 1)
You can now schedule the profile or manually run the profile
Conclusion
In this article, you have learned about the AUTOINC variable and the benefits of using it. Now, you can easily use it in your profiles to create full, incremental, or differential backups of your important data.