cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

List files in Databricks Workspace with Databricks CLI

Stefan-Koch
Contributor II

I want to list all files in my Workspace with the CLI

There's a command for it: 

databricks fs ls dbfs:/

When I run this, I get this result:
 StefanKoch_0-1730407022149.png

I can then list the content of databricks-datasets, but no other directory. 

How can I list the content of the Workspace? Or how can I list as example this:

StefanKoch_1-1730407116748.png

 

2 REPLIES 2

MaximeGendre
New Contributor III

Hello,
workspace files are not stored in the DBFS.
If you want to use the CLI : 

first :

%pip install -U -qqqq databricks-sdk
then :
from databricks.sdk import WorkspaceClient
client = WorkspaceClient()
for i in client.workspace.list(f'/<your_path>', recursive=True๐Ÿ˜ž
    print(i.path)
 
Documentation is available here : 
 

Stefan-Koch
Contributor II

I know it's possible with Databricks SDK, but I want to solve it with the CLI on the Terminal. 

 

Connect with Databricks Users in Your Area

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