rdrop2 icon indicating copy to clipboard operation
rdrop2 copied to clipboard

Error when calling drop_share using a variable as path name

Open wmcraver opened this issue 9 years ago • 1 comments

I'm attempting to iterate over a directory of files to get a list of URLs (share URLs). When I do this by passing a variable in for the path argument in drop_share function, I receive an error: error = The input field 'path.path' was not expected." When I pass in the actual string contained in the variable passed in, drop_share works fine.

Below is an example of my code that I was writing to test this functionality:

files <- drop_dir(path = "Sharing Folder/SP16SSTRosterValidation")

for (i in 1:nrow(files)) {
    locat <- files[i,1]
    drop_share(locat)
}

wmcraver avatar Apr 12 '16 18:04 wmcraver

Thanks for the issue. Here is how I'd do it:

files <- drop_dir(path = "Sharing Folder/SP16SSTRosterValidation")
result_urls <- list()

for (i in 1:nrow(files)) {
  locat <- files[i,]$path
  result_urls[i] <- drop_share(locat)$url
}

results <- data_frame(unlist(link_list))

Below is an example I tried on my Dropbox folder.

x <- drop_dir("Public/gifs")
class(x)
link_list <- list()
# I have too many gifs
x <- x[1:10, ]

for(i in 1:nrow(x)) {
  locat <- x[i,]$path
  link_list[i] <- drop_share(locat)$url
}

results <- data_frame(unlist(link_list))

Does that solve the issue?

karthik avatar Jun 21 '16 21:06 karthik