drive_reveal

0th

Percentile

Add column(s) with new information

drive_reveal() adds extra information about your Drive files that is not automatically present in the default dribble produced by googledrive. Why is this info not always present?

  1. You don't always care about it.

  2. It may require calling different endpoints in the Drive API. Example: getting a file's permissions.

  3. It might require additional API calls. Example: figuring out the path(s) associated with a specific file.

Usage
drive_reveal(file, what = c("path", "trashed", "mime_type",
  "permissions", "published"))
Arguments
file

Something that identifies the file(s) of interest on your Google Drive. Can be a character vector of names/paths, a character vector of file ids or URLs marked with as_id(), or a dribble.

what

Character, describing the type of info you want to add:

  • path. Warning: this can be slow, especially if called on many files.

  • trashed

  • mime_type

  • permissions. Who is this file shared with and in which roles?

  • published

Value

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

Special considerations for paths

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. This implies the length of the input (i.e. the number of input paths or the number of rows in a dribble) will not necessarily equal the number rows in the output.

Trashed

When what = "trashed", the dribble gains a logical variable that indicates whether a file is in the trash..

MIME type

When what = "mime_type", the dribble gains a variable of MIME types.

Permissions

When what = "permissions" the dribble gains a logical variable shared that indicates whether a file is shared and a new list-column permissions_resource containing lists of Permissions resources.

Publishing

When what = "published" the dribble gains a logical variable published that indicates whether a file is published and a new list-column revision_resource containing lists of Revisions resources.

Aliases
  • drive_reveal
Examples
# NOT RUN {
## Get a nice, random selection of files
files <- drive_find(n_max = 10, trashed = NA)

## Reveal
##   * paths (warning: can be slow for many files!)
##   * if `trashed` or not
##   * MIME type
##   * permissions, i.e. sharing status
##   * if `published` or not
drive_reveal(files, "path")
drive_reveal(files, "trashed")
drive_reveal(files, "mime_type")
drive_reveal(files, "permissions")
drive_reveal(files, "published")

## 'root' is a special file id that always represents your root folder
drive_get(id = "root") %>% drive_reveal("path")
# }
Documentation reproduced from package googledrive, version 0.1.2, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.