Learn R Programming

cloudfs (version 0.1.3)

cloud_s3_upload_bulk: Bulk Upload Files to S3

Description

This function facilitates the bulk uploading of multiple files from the local project folder to the project's designated S3 folder. By using cloud_local_ls, you can obtain a dataframe detailing the contents of the local folder. Applying cloud_s3_upload_bulk to this dataframe allows you to upload all listed files to S3.

Usage

cloud_s3_upload_bulk(content, quiet = FALSE, root = NULL)

Value

Invisibly returns the input content dataframe.

Arguments

content

(data.frame) Output of cloud_s3_ls()

quiet

All caution messages may be turned off by setting this parameter to TRUE.

root

S3 path of the project root. This serves as the reference point for all relative paths. When left as NULL, the root is automatically derived from the cloudfs.s3 field of the project's DESCRIPTION file.

Examples

Run this code
if (FALSE) { # interactive()
# create toy plots: 2 png's and 1 jpeg
dir.create("toy_plots")
png("toy_plots/plot1.png"); plot(rnorm(100)); dev.off()
png("toy_plots/plot2.png"); plot(hist(rnorm(100))); dev.off()
png("toy_plots/plot3.jpeg"); plot(hclust(dist(USArrests), "ave")); dev.off()

# upload only the two png's
cloud_local_ls("toy_plots")  |> 
  dplyr::filter(type == "png")  |> 
  cloud_s3_upload_bulk()

# clean up
unlink("toy_plots", recursive = TRUE)
  
}

Run the code above in your browser using DataLab