Unable to delete folder in databricks "DBFS://

prado 1 Reputation point
2020-12-17T04:16:28.657+00:00

Hi,

When I run the command %fs ls '/' in the results I see a folder path as "dbfs://" and name as "/".
and tried to run the command in the notebook %fs ls '//' I get the java error and even not able to delete the folder.
Please help me how to remove the folder.

Thanks!

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,222 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 90,231 Reputation points
    2020-12-17T05:31:43.58+00:00

    Hello @prado ,

    Welcome to the Microsoft Q&A platform.

    When you say "When I run the command %fs ls '/' in the results I see a folder path as "dbfs://" and name as "/".", could you please share the screenshot?

    Note: When I run the command %fs ls '/' in the results I see a folder path as dbfs:/.

    49012-image.png

    How to delete a folder in databricks "DBFS:/"?

    # List the DBFS root  
      
    %fs ls  
      
    # Recursively remove the files under foobar  
      
    %fs rm -r dbfs:/foobar  
    

    49002-image.png

    For more details, refer Azure Databricks - Access DBFS.

    Hope this helps. Do let us know if you any further queries.

    ------------

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.
    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.