List files in Databricks Workspace with Databricks CLI

Stefan-Koch
Databricks Partner

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

 

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
Databricks Partner

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