Question

How can I backup a file or directory as part of my installation?

How can I backup a file or directory as part of my installation?

Answer:

You can backup a file or directory using a <backupFile> action as in the following example:

<createBackupFile>
  <path>${installdir}/conf/myapp.conf</path>
</createBackupFile>

This action creates a new file or directory, named after the path specified, with the suffix .bak0. If a backup file with that name already exists, it will create a new one ending in .bak1 (or .bak2, etc.)