Retrieve metadata for files specified via path or via file id.
If the files are specified via
path, the returned
will include a
path variable. To add path information to any
that lacks it, use
drive_reveal(d, "path"). If
you want to list the contents of a folder, use
drive_ls(). For general
Note: Team Drives are only available to users of certain enhanced Google services, such as G Suite Enterprise, G Suite Business, or G Suite for Education.
Character vector of path(s) to get. Use a trailing slash to
indicate explicitly that a path is a folder, which can disambiguate if
there is a file of the same name (yes this is possible on Drive!). A
character vector marked with
Character vector of Drive file ids or URLs (it is first processed
Anything that identifies one specific Team Drive: its name,
its id or URL marked with
Character, specifying the search collection. Only relevant in
the Team Drives context. If specified, must be one of
Logical, indicating whether to print informative messages
An object of class
dribble, a tibble with one row per item.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
## Not run: ## get info about your "My Drive" root folder drive_get("~/") ## the API reserves the file id "root" for your root folder drive_get(id = "root") drive_get(id = "root") %>% drive_reveal("path") ## multiple names drive_get(c("abc", "def")) ## multiple names, one of which must be a folder drive_get(c("abc", "def/")) ## query by file id(s) drive_get(id = "abcdefgeh123456789") drive_get(as_id("abcdefgeh123456789")) drive_get(id = c("abcdefgh123456789", "jklmnopq123456789")) ## access the Team Drive named "foo" ## team_drive params must be specified if getting by path foo <- team_drive_get("foo") drive_get(c("this.jpg", "that-file"), team_drive = foo) ## team_drive params are not necessary if getting by id drive_get(as_id("123456789")) ## search all Team Drives and other files user has accessed drive_get(c("this.jpg", "that-file"), corpus = "all") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.