Skip to contents

Print a tree of the objects in a bucket

Usage

aws_bucket_tree(bucket, recurse = TRUE, ...)

Arguments

bucket

(character) bucket name; must be length 1. required

recurse

(logical) returns all AWS S3 objects in lower sub directories, default: TRUE

...

Additional arguments passed to s3fs::s3_dir_tree()

Value

character vector of objects/files within the bucket, printed as a tree

Examples

if (FALSE) { # interactive()
bucket_name <- random_string("bucket")
if (!aws_bucket_exists(bucket_name)) aws_bucket_create(bucket_name)
links_file <- file.path(system.file(), "Meta/links.rds")
pkgs_file <- file.path(system.file(), "Meta/package.rds")
demo_file <- file.path(system.file(), "Meta/demo.rds")
aws_file_upload(
  c(links_file, pkgs_file, demo_file),
  s3_path(
    bucket_name,
    c(
      basename(links_file),
      basename(pkgs_file),
      basename(demo_file)
    )
  )
)
aws_bucket_tree(bucket_name)

# cleanup
objs <- aws_bucket_list_objects(bucket_name)
aws_file_delete(objs$uri)
aws_bucket_delete(bucket_name, force = TRUE)
aws_bucket_exists(bucket_name)
}