โ07-25-2024 06:22 AM
Hello,
I am trying to delete a folder and its content using databricks cli, but I'm getting the following error:
databricks workspace delete /Workspace/Users/XXX/XXX --profile DEFAULT --recursive true
Error: expected to have the absolute path of the notebook or directory
I have tried deleting a single file, and it's working. It's only when I try to delete a folder that it fails.
Thank you in advance!
โ07-25-2024 06:39 AM - edited โ07-25-2024 06:42 AM
Hi @joaogilsa ,
Delete true after recursive and it should work ๐ Look at below help output. It looks like that recursive it's already boolean flag, so when you add true I think it has problem with parsing:
Delete a workspace object.
Deletes an object or a directory (and optionally recursively deletes all
objects in the directory). * If path does not exist, this call returns an
error RESOURCE_DOES_NOT_EXIST. * If path is a non-empty directory and
recursive is set to false, this call returns an error
DIRECTORY_NOT_EMPTY.
Object deletion cannot be undone and deleting a directory recursively is not
atomic.
Arguments:
PATH: The absolute path of the notebook or directory.
Usage:
databricks workspace delete PATH [flags]
Flags:
-h, --help help for delete
--json JSON either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes))
--recursive The flag that specifies whether to delete the object recursively.
โ07-25-2024 06:39 AM - edited โ07-25-2024 06:42 AM
Hi @joaogilsa ,
Delete true after recursive and it should work ๐ Look at below help output. It looks like that recursive it's already boolean flag, so when you add true I think it has problem with parsing:
Delete a workspace object.
Deletes an object or a directory (and optionally recursively deletes all
objects in the directory). * If path does not exist, this call returns an
error RESOURCE_DOES_NOT_EXIST. * If path is a non-empty directory and
recursive is set to false, this call returns an error
DIRECTORY_NOT_EMPTY.
Object deletion cannot be undone and deleting a directory recursively is not
atomic.
Arguments:
PATH: The absolute path of the notebook or directory.
Usage:
databricks workspace delete PATH [flags]
Flags:
-h, --help help for delete
--json JSON either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes))
--recursive The flag that specifies whether to delete the object recursively.
โ07-25-2024 06:42 AM
Thank you for the help, @szymon_dybczak, it worked!
โ07-25-2024 06:43 AM
Cool, glad that it worked ๐
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group