Directory

class Directory

Any table or query result on Redivis that contains file ids can be read as a directory, where the file names are parsed according to any / separators, and a directory tree is created.

This virtual directory can then be used to navigate, download, and even mount a given file tree.

Constructors

Returns a subdirectory within a directory.

Load query results that contain a file_id variable as a directory.

Load any table contains a file_id variable as a directory.

Examples

dir <- redivis$table("table_ref")$to_directory()
print(dir$list()) # list files + directories within this directory
all_files <- dir$list(mode="files", recursive=True)

file <- dir$get("path/to/file.txt") # Will return None if doesn't exist
subdir <- dir$get("path/to/subdir")

Attributes

path

The path of this directory relative to the root directory in the current tree. The path of the top-level directory (that is, any directory returned from table / query $to_directory() ) will always be "/"

query

A reference to the Query that constructed this directory. Will be None if the directory is derived from a table.

table

A reference to the Table that constructed this directory. Will be None if the directory is derived from a query.

Methods

Directory$download([path, overwrite, ...])

Downloads files in the directory to the specified path.

Get a file or directory relative to this directory

Directory$list([max_results, mode, recursive])

List the contents of a directory

Directory$mount([path, foreground])

Mount the directory as a volume at the provided path, allowing files to be lazily loaded as they're accessed.

Directory$unmount([path, foreground])

Unmounts a previously mounted directory.

Last updated

Was this helpful?