Skip to content
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

Question from arati krishnamoorthy (U0266JVP0HF) #88

Open
jonthegeek opened this issue Oct 26, 2023 · 3 comments
Open

Question from arati krishnamoorthy (U0266JVP0HF) #88

jonthegeek opened this issue Oct 26, 2023 · 3 comments
Labels
question Further information is requested
Milestone

Comments

@jonthegeek
Copy link
Member

Hi all, I have 2 questions i could use some help with. The first one is how do I go about reading from a google drive that has multiple layers of nested folders. I want a script that looks at all the folders/subfolders and downloads all the .docx files that follow a certain name format. Is there a package that can iterate through folders/subfolders on a google drive?

@jonthegeek jonthegeek added this to the R Data Import milestone Oct 26, 2023
@jonthegeek jonthegeek added the question Further information is requested label Oct 26, 2023
@jonthegeek
Copy link
Member Author

Reply from Priyanka (UL0BK1MUY)

I think you are looking for purrr pkg.

@jonthegeek
Copy link
Member Author

Reply from Marc-Aurèle Rivière (U03UL96V2G7)

A combination of the googledrive and purrr packages should do the trick:

dest_folder <- here::here("data", "drive") |> fs::dir_create()
drive_find(pattern = ".*.docx", type = drive_mime_type("docx")) |> 
  pwalk(\(name, id, drive_resource) drive_download(as_id(id), path = here(dest_folder, name), overwrite  = TRUE))

@jonthegeek
Copy link
Member Author

Reply from arati krishnamoorthy (U0266JVP0HF)

thank you i will play around with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: ✅ Answered
Development

No branches or pull requests

1 participant