rdrop2
rdrop2 copied to clipboard
Allow drop_upload to put file directly in folder
In order to upload a file into a folder without giving it a different (base)name, a user has to build the path themselves, e.g. drop_upload(file, paste0(folder, "/", file))
. This happens a lot in our tests, too.
I think we should be able to do this in the function, as in drop_download
.
The trick is that we'd have to check if the path
argument is a dropbox folder. The right way to do that is probably to use drop_get_metadata
, and if it returns metadata, check the .tag
. Then we could make functions like drop_is_folder
and drop_is_file
, which would look a lot like drop_exists
but with an additional check for the tag.
This is totally doable. 😴 now. But before I head to sleep:
These functions (https://github.com/karthik/rdrop2/blob/master/R/drop_file_ops.R#L293-L317) will give you what you need to get a TRUE or FALSE on drop_is_folder
. If TRUE, then we append the filename to the path and push it there.
You can see this working in drop_copy
and drop_move
.