Databricks icon

Databricks

Interact with Databricks API

Files → Delete Directory

AI-generated

Overview

This node operation deletes a directory within a specified volume in Databricks Unity Catalog. It is useful for managing file storage by removing directories that are no longer needed, helping to keep the storage organized and free of unnecessary data.

Use Case Examples

  1. Deleting an empty or obsolete directory from a volume to free up space.
  2. Automating cleanup of directories in a data pipeline after processing is complete.

Properties

Name Meaning
Volume Path Full path to the volume in the format catalog.schema.volume, specifying the target volume where the directory exists.
Directory Path Path to the directory within the volume to be deleted, specified without a leading slash (e.g., 'folder1' or 'folder1/subfolder').

Output

JSON

  • success - Indicates whether the directory deletion was successful (true/false).
  • message - A message confirming the directory was deleted successfully, including the directory path.
  • volumePath - The volume path where the directory was deleted.
  • directoryPath - The path of the directory that was deleted.

Dependencies

  • Databricks API with an API token for authentication

Troubleshooting

  • Ensure the volume path is correctly formatted as catalog.schema.volume; otherwise, an error is thrown.
  • Check that the directory path does not include a leading slash.
  • API errors such as authorization failures or non-existent directories will be reported and can be handled by enabling 'Continue On Fail' to avoid stopping the workflow.

Links

  • Databricks Files API - Official documentation for managing files and directories in Databricks Unity Catalog volumes.

Discussion