backup_file: Backup a file if necessary

Description Usage Arguments Details Value

View source: R/misc_fun.R

Description

Backup a file if necessary

Usage

1
backup_file(path, sep = "_", stamp = "%y%m%d")

Arguments

path

A file path.

sep

A character to separate the existing file path and the stamp added.

stamp

A datestamp (default) and/or timestamp constructed according to this specification (POSIXct) is added to pre-existing files in path.

Details

The stamp is extracted from an existing file's modification time. For details file.mtime(...). If a backup file with the same stamp exists, it is replaced In practical terms this means that by using "%y%m%d" as stamp, only the last backup per day is preserved.

Value

TRUE if succesful, FALSE otherwise.


benjbuch/summerr documentation built on July 11, 2021, 9:40 a.m.