googledrive (version 0.0.0.9000)

drive_list: List files on Google Drive

Description

List files on Google Drive

Usage

drive_list(path = NULL, pattern = NULL, ..., verbose = TRUE)

Arguments

path

character. Google Drive path to list. Defaults to "My Drive", but without regard to any folder hierarchy. If path uniquely identifies a folder, its contents are listed, not recursively. Use a trailing slash to indicate explicitly that the path is a folder, which can disambiguate if there is a file of the same name (yes this is possible on Drive!). If path uniquely identifies a file, that single file is listed.

pattern

character. If provided, only the files whose names match this regular expression are returned.

...

Parameters to pass along to the API query.

verbose

logical. Indicates whether to print informative messages.

This will default to the most recent 100 files on your Google Drive. For example, to get 200 instead, specify the pageSize, i.e. drive_ls(pageSize = 200). Helpful links for forming queries:

Value

tibble with one row per file

Examples

Run this code

## list "My Drive" w/o regard for folders
drive_list()

## list files that specifically live at the top-level of "My Drive"
drive_list("~/")

## just folders
drive_list(q = "mimeType = 'application/vnd.google-apps.folder'")

## just folders that have the folder with id 'abc' as direct parent
drive_list(q = "'abc' in parents and mimeType='application/vnd.google-apps.folder'")

## files that match a regex
drive_list(pattern = "jt")

## list the contents of the 'jt01' folder
drive_list("jt01/")

## list user's Google Sheets
drive_list(q = "mimeType='application/vnd.google-apps.spreadsheet'")


Run the code above in your browser using DataCamp Workspace