@Generated public class FilesAPI extends Object
The API supports [Unity Catalog volumes], where files and directories to operate on are specified using their volume URI path, which follows the format /Volumes/<catalog_name>/<schema_name>/<volume_name>/<path_to_file>.
The Files API has two distinct endpoints, one for working with files (`/fs/files`) and another one for working with directories (`/fs/directories`). Both endpoints use the standard HTTP methods GET, HEAD, PUT, and DELETE to manage files and directories specified using their URI path. The path is always absolute.
Some Files API client features are currently experimental. To enable them, set `enable_experimental_files_api_client = True` in your configuration profile or use the environment variable `DATABRICKS_ENABLE_EXPERIMENTAL_FILES_API_CLIENT=True`.
Use of Files API may incur Databricks data transfer charges.
[Unity Catalog volumes]: https://docs.databricks.com/en/connect/unity-catalog/volumes.html
| Constructor and Description |
|---|
FilesAPI(ApiClient apiClient)
Regular-use constructor
|
FilesAPI(FilesService mock)
Constructor for mocks
|
public FilesAPI(ApiClient apiClient)
public FilesAPI(FilesService mock)
public void createDirectory(CreateDirectoryRequest request)
public void delete(String filePath)
public void delete(DeleteFileRequest request)
public void deleteDirectory(String directoryPath)
public void deleteDirectory(DeleteDirectoryRequest request)
To delete a non-empty directory, first delete all of its contents. This can be done by listing the directory contents and deleting each file and subdirectory recursively.
public DownloadResponse download(String filePath)
public DownloadResponse download(DownloadRequest request)
public void getDirectoryMetadata(String directoryPath)
public void getDirectoryMetadata(GetDirectoryMetadataRequest request)
This method is useful to check if a directory exists and the caller has access to it.
If you wish to ensure the directory exists, you can instead use `PUT`, which will create the directory if it does not exist, and is idempotent (it will succeed if the directory already exists).
public GetMetadataResponse getMetadata(String filePath)
public GetMetadataResponse getMetadata(GetMetadataRequest request)
public Iterable<DirectoryEntry> listDirectoryContents(String directoryPath)
public Iterable<DirectoryEntry> listDirectoryContents(ListDirectoryContentsRequest request)
public void upload(UploadRequest request)
public FilesService impl()
Copyright © 2026. All rights reserved.