Skip to contents

Creates a new timestamped archive in GCS from local files. Only creates a new archive if local files differ from the latest archive. The archive timestamp is derived from the maximum file modification time (not render/wall-clock time), so re-rendering with unchanged files produces the same timestamp and skips upload.

Usage

sync_to_gcs_archive(
  dir_csv,
  provider,
  dataset,
  gcs_bucket = "calcofi-files-public",
  archive_prefix = "archive",
  force = FALSE
)

Arguments

dir_csv

Local directory containing CSV files

provider

Data provider

dataset

Dataset name

gcs_bucket

GCS bucket name

archive_prefix

Archive folder prefix

force

Force creation even if files match latest archive

Value

List with:

  • archive_timestamp: Timestamp of the archive used/created

  • archive_path: Full GCS path to archive

  • created_new: Logical, TRUE if new archive was created

  • files_uploaded: Number of files uploaded (0 if using existing)

Examples

if (FALSE) { # \dontrun{
result <- sync_to_gcs_archive(
  dir_csv  = "/path/to/csv",
  provider = "swfsc.noaa.gov",
  dataset  = "calcofi-db")

message(glue("Using archive: {result$archive_timestamp}"))
} # }