-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download everything on a folder #144
Comments
Thanks! The folders aren't real folders even though they look it in the web interface, just names with / in them. I usually do something like this that uses the my_folder <- "your_folder/"
objs <- gcs_list_objects(prefix = my_folder)
# to download to same named folder
dir.create(my_folder)
# download all the objects to that folder
dls <- lapply(objs$name, function(x) gcs_get_object(x, saveToDisk = x)) |
Thank you so much for the quick response! Thats a very clever way of handling the request! However, when I try this, the following error message appears a couple of times:
and then:
Do you know why this happens? |
Hmm is the folder created at the location? |
|
Ah! I figure it out, the problem is that with objs <- objs %>%
dplyr::filter(name != my_folder) and then run dls <- lapply(objs$name, function(x)
gcs_get_object(x, saveToDisk = x)) everything works fine. Also, for dls <- map(objs$name, ~gcs_get_object(., saveToDisk = .)) Works justs as fine |
Ah weird, my test example didn't have the empty folder name, perhaps a relic of what was uploaded. Yes a tidy way could be a chain like this using library(tidyverse)
my_folder <- "my_folder/"
dir.create(my_folder)
my_folder %>%
gcs_list_objects(prefix = .) %>%
dplyr::filter(name != my_folder) %>%
pluck("name") %>%
walk(~gcs_get_object(., saveToDisk = ., overwrite = TRUE)) |
As I understand, with
gcs_get_object()
you can download an object that is not a traditional R object like a .mp4 just by saying:But what happens if I want to download a whole folder that has multiple types of objects, including .mp4, .png, etc.?
Is this possible?
If so, how?
If not, can you consider adding this feature?
Thanks in advance, your package is amazing
The text was updated successfully, but these errors were encountered: