# \donttest{
# Create temporary directory for example
temp_dir <- tempfile()
dir.create(temp_dir)
# Initialise and create some content
boilerplate_init(data_path = temp_dir, categories = "methods",
create_dirs = TRUE, confirm = FALSE, quiet = TRUE)
db <- boilerplate_import(data_path = temp_dir, quiet = TRUE)
# Create a backup by saving with timestamp
boilerplate_save(db, data_path = temp_dir, timestamp = TRUE,
confirm = FALSE, quiet = TRUE)
# List available files to see backup
files <- boilerplate_list_files(data_path = temp_dir)
# Create a proper backup by using create_backup parameter
boilerplate_save(db, data_path = temp_dir, create_backup = TRUE,
confirm = FALSE, quiet = TRUE)
# Now list files again to see the backup
files <- boilerplate_list_files(data_path = temp_dir)
# View latest backup without restoring
if (nrow(files$backups) > 0) {
backup_db <- boilerplate_restore_backup(data_path = temp_dir)
}
# Clean up
unlink(temp_dir, recursive = TRUE)
# }
Run the code above in your browser using DataLab