aws_file_copy | R Documentation |
Copy files between buckets
aws_file_copy(remote_path, bucket, force = FALSE, ...)
remote_path |
(character) one or more remote S3 paths. required |
bucket |
(character) bucket to copy files to. required. if the bucket does not exist we prompt you asking if you'd like the bucket to be created |
force |
(logical) force bucket creation without going through
the prompt. default: |
... |
named parameters passed on to |
vector of paths, length matches length(remote_path)
Other files:
aws_file_attr()
,
aws_file_delete()
,
aws_file_download()
,
aws_file_exists()
,
aws_file_rename()
,
aws_file_upload()
,
six_file_upload()
bucket1 <- random_bucket()
aws_bucket_create(bucket1)
# create files in an existing bucket
tfiles <- replicate(n = 3, tempfile())
for (i in tfiles) cat("Hello\nWorld\n", file = i)
paths <- s3_path(bucket1, c("aaa", "bbb", "ccc"), ext = "txt")
aws_file_upload(tfiles, paths)
# create a new bucket
bucket2 <- random_bucket()
new_bucket <- aws_bucket_create(bucket = bucket2)
# add existing files to the new bucket
aws_file_copy(paths, bucket2)
# or, create a bucket that doesn't exist yet
bucket3 <- random_bucket()
aws_file_copy(paths, bucket3, 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.