Conditional execution of backup tasks in APBackup.

APBackup allows you to start the backup process only when a specific condition is met. In the current version of the program, this can be either presence or absence of a specific file or folder at the moment the task is executed.

Conditional task execution can be configured on the “Schedule” – “Conditional execution” tab

The condition is checked before the start of the backup task and a negative result is treated as a task execution error, which means that you can use it to configure the program to repeat the execution attempt if an error occurs:

Besides, you can use standard file search masks in conditions, so you can configure a task to start when at least one .doc file exists in a given folder:

Example: d:backup*.doc

Below are some examples of conditional execution:

Backing up data to a portable drive (such as a USB drive).

For instance, you want to back up some data and save them to a portable drive once a day. The problem is that the drive may not be connected – and you want to start the backup process immediately once it’s connected.

Let’s configure a regular task to start at 9 AM. The source will be located on a local drive. The backup copy will be saved on a portable drive. If the program encounters an error, it will repeat the backup attempt in 5 minutes. Let’s use the presence of E:backup on a portable drive as a condition for the execution of our task.

Therefore, the task will start at 9 AM and will be repeated every 5 minutes until the program locates E:backup – that is, until a portable drive is found. After that, the task will save the backup copy on the portable drive and will stop until the next day. Therefore, all you need to do is connect a portable drive and wait for some time for the program to save the backup copy automatically.

Waiting for files to be unlocked for backing them up.
Let’s assume we need to back up a database or a folder being used by someone. You can tell whether any file is opened by looking for specific files, for instance, *.lck for dbf files, *.ldb files for Access databases (.mdb) or !$*.doc temporary files for MS Word. So the data backup task should be executed only if there are no such files in the source folder.

In this case, you need to use the “File does not exist” condition and leave all other parameters exactly as in the first example.

In this example, the task will be executed only if there are no *.ldb files – that is, if an *.mdb file is not currently opened in MS Access.