Description Usage Arguments Value Examples
View source: R/cloud-functions.R
The function supports moving files or folders from bucket to bucket, disk to bucket and bucket to disk. Note that the existing destination file will be overwritten.
1 | gcs_cp(from, to, recursive = TRUE, billing_project = gcs_get_requester_pays())
|
from, to |
the character path to a bucket/folder/file or a FolderClass/FileClass object returned by 'gcs_dir'. At least one path must be a google URI. It is recommended to explicitly add a trailing "/" if the parameter is a path to a folder. |
recursive |
logical(1). Whether to recursively copy the files in the subfolders. |
billing_project |
logical(1) or character(1). If logical, whether users should pay the cost for accessing the data. The billing project is the project ID in 'gcs_get_billing_project()'. If character, it represents the project ID that will be charged by Google. |
No return value
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | tmp_path <- tempdir()
## Download a file to a disk
gcs_cp("gs://genomics-public-data/NA12878.chr20.sample.bam", tmp_path)
## Check the file existance
file.exists(file.path(tmp_path, "NA12878.chr20.sample.bam"))
## Download all files in a path.
## The files in the subfolders will not be copied due to `recursive = FALSE`
folder_path <- file.path(tmp_path, "example")
gcs_cp("gs://genomics-public-data/", folder_path, recursive = FALSE)
## Check the file existance
list.files(folder_path)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.