six_bucket_upload | R Documentation |
Magically upload a mix of files and directories into a bucket
six_bucket_upload(path, remote, force = FALSE, ...)
path |
(character) one or more file paths to add to
the |
remote |
(character/scalar) a character string to use to upload
files in |
force |
(logical) force bucket creation without going through
the prompt. default: |
... |
named params passed on to put_object |
(character) a vector of remote s3 paths where your files are located
Exits early if folder or files do not exist
Creates the bucket if it does not exist
Adds files to the bucket at the top level with key as the file name
Adds directories to the bucket, reconstructing the exact directory structure in the S3 bucket
Other buckets:
aws_bucket_create()
,
aws_bucket_delete()
,
aws_bucket_download()
,
aws_bucket_exists()
,
aws_bucket_list_objects()
,
aws_bucket_tree()
,
aws_bucket_upload()
,
aws_buckets()
,
six_bucket_delete()
Other magicians:
six_admin_setup()
,
six_bucket_delete()
,
six_file_upload()
,
six_user_create()
,
six_user_delete()
# single file, single remote path
bucket1 <- random_bucket()
demo_rds_file <- file.path(system.file(), "Meta/demo.rds")
six_bucket_upload(path = demo_rds_file, remote = bucket1, force = TRUE)
## a file and a directory - with a single remote path
bucket2 <- random_bucket()
library(fs)
tdir <- path(path_temp(), "mytmp")
dir_create(tdir)
invisible(purrr::map(letters, \(l) file_create(path(tdir, l))))
dir_tree(tdir)
six_bucket_upload(path = c(demo_rds_file, tdir), remote = bucket2,
force = TRUE)
## a directory with nested dirs - with a single remote path
bucket3 <- random_bucket()
library(fs)
tdir <- path(path_temp(), "apples")
dir_create(tdir)
dir_create(path(tdir, "mcintosh"))
dir_create(path(tdir, "pink-lady"))
cat("Some text in a readme", file = path(tdir, "README.md"))
write.csv(Orange, file = path(tdir, "mcintosh", "orange.csv"))
write.csv(iris, file = path(tdir, "pink-lady", "iris.csv"))
dir_tree(tdir)
six_bucket_upload(path = tdir, remote = path(bucket3, "fruit/basket"),
force = TRUE)
# cleanup
six_bucket_delete(bucket1, force = TRUE)
six_bucket_delete(bucket2, force = TRUE)
six_bucket_delete(bucket3, force = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.