This is NOT a duplicate. I am trying to retrieve files in a specific folder.
I want this statement f <- drive_find(n_max=30) to return only the files in a specific directory. How do I point it to a specific directory?
For more detail on what I am doing, see below.
I am using R and can download files with the following code:
install.packages("googledrive")
#load googledrive
library("googledrive")
drive_download(file = as_id(drive_find(pattern = "abc.xlsx", n_max = 30)$id),
path = "/Users/me/Desktop/abc.xlsx")
But I want to download only specific files in a specific directory and I don't know how to specify that directory specifically and exclusively.
I have tried drive_get
and drive_download
but am unable to specify a specific directory.
f <- drive_find(n_max = 30) # this gives me a list of files
for (i in 1:nrow(f)){
d_path <- f$name[i]
drive_download(file = as_id(drive_find(pattern = f$name[i], n_max = 30)$id),
path = paste("/Users/me/Desktop/Gdrive/", d_path, sep =""))
}
The problem is that the statement f <- drive_find(n_max = 30)
gives me a list that includes folders and files I do not want. So I need to specify the exact directory to look in. How do I do that?