cloud_drive_find_path: Find Google Drive folder based on a path

View source: R/drive_setup.R

cloud_drive_find_pathR Documentation

Find Google Drive folder based on a path

Description

Given a Google Drive id pointing to a folder and a relative path inside this folder, returns id of the object (file or folder) corresponding to this path.

Usage

cloud_drive_find_path(root, path = "", create = FALSE)

Arguments

root

ID of the folder to start search at.

path

Relative location with respect to the root folder.

create

Create folders describing path if they do not exist? Default is FALSE so by default the function throws an error if path was not found. If TRUE, the function will create all missing subdirectories. Note that the object on the deepest level will always be created as a folder. E.g. if path = "models/kmeans/model.Rds" and "model.Rds" is missing, this function will create a folder with such name.

Details

Google Drive file structure is different from the usual file structure like e.g. on Linux or Windows. A folder on Google Drive can have two or more child folders with the same name. Google Drive marks files and folders with so-called id values to distinguish between them. These values are always unique. You can see them in browser URL for example. The concept of "name" is in the first place for convenience of the end user.

In such a setup a relative file path may correspond to multiple files or folders. This function however works under assumption that the relative path you pass to it defines strictly one object. If there's any ambiguity it throws an error.

Value

A googledrive::dribble object corresponding to the folder.


cloudfs documentation built on May 29, 2024, 11:08 a.m.