Directory.get

Directory.get(path) → File | Directory | None

This method allows you to navigate directory a directory structure using standard path semantics. Returns None if no file or directory exists at the given path.

Parameters:

path : str | pathlib.Path The path of the file or directory, relative to this directory within the tree. Follows standard path semantics, including relative and absolute paths. When providing an absolute path, the directory root – that is, directory.get("/") – will always be the top level directory in the current directory tree.

Returns:

File | Directory | None

Examples:

import redivis

dir = redivis.table("table_ref").to_directory()

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

print(subdir.get("../").path) # -> "/path/to"
rootdir = subdir.get("/")

Last updated

Was this helpful?