googledrive (version 0.0.0.9000)

drive_add_path: Get paths to Drive files.

Description

Even though you know a Drive file's name or id, you don't necessarily know its path(s). This function takes Drive files, specified via a dribble or a vector of file ids or URLs, and returns a dribble that includes a path variable.

Note that Google Drive does NOT behave like your local file system:

  • File and folder names need not be unique, even at a given level of the hierarchy. A single name or file path can be associated with multiple files (or zero or exactly one).

  • A file can have more than one direct parent. This implies that a single file can be represented by multiple paths.

Bottom line: Do not assume there is a one-to-one relationship between file name or path and a Drive file or folder. A file id is unique, which is why googledrive workflows favor storage in a dribble, which holds metadata aimed at computers (file id) and humans (file name). Finally, note also that a folder is just a specific type of file on Drive.

Usage

drive_add_path(file)

Arguments

file

A dribble or vector of file ids or URLs.

Value

An object of class dribble, a tibble with one row per item.

Examples

Run this code
# NOT RUN {
## 'root' is a special file id that always represents your root folder
drive_get(id = "root") %>% drive_add_path()
# }

Run the code above in your browser using DataLab