List objects in a Google Cloud Storage bucket
gcs_list_objects.RdLists all object names in a GCS bucket, optionally filtered by a prefix. Returns a character vector of object names.
Details
This function wraps googleCloudStorageR::gcs_list_objects() and extracts
just the object names as a character vector using dplyr::pull().
The prefix parameter can be used to filter results to objects within a specific "folder" or matching a specific pattern. Note that GCS uses a flat namespace, so prefixes simulate directory structures.
See also
googleCloudStorageR::gcs_list_objects() for full object details
Examples
if (FALSE) { # \dontrun{
# List all objects in a bucket
all_objects <- gcs_list_objects("my-project-data")
# List objects in a specific "folder"
csv_files <- gcs_list_objects("my-project-data", prefix = "raw/")
# List objects with a specific prefix
sales_files <- gcs_list_objects("my-project-data", prefix = "sales_2024")
} # }