There are several different backup modes available, choosen via the copyRequest::base::backupModeName option –backupMode
- none: the outputfile is just written, if it existed before it's overwritten, which on posix file systems means O_TRUNC as open option.
- before: If the destination file already exists its renamed to ${old name}backupSuffix
- during: If the destination file already exists its renamed to ${old name}backupSuffix, on sucessful copy the old file is then removed. In case of failure it's left intact.
- after: The destination file will be written to <destination>backupSuffix, or if backupSuffix is empty to a temporary name (created via mkstemps() on posix filesystems, by appending time in ns to the destination name otherwise) and after a sucessful copy it is renamed to destination, replacing the existing destination file atomically.
- remove: If an old destination file exists it's explicitly removed before attempting to write the new one.
- The backup suffix
- The backup suffix is set via the
–backupSuffix
option. If the backup suffix contains a %keyword or %{keyword} then that pattern is replaced by the expansion of the keyword, see Expansion of key words in attributes. There may be multiple keywords in the backup suffix. The %{keyword} form must be used if the keyword is not the end of the backup suffix string! Also note that a dot (.) after the file name must be explicitly included in the suffix.