OneLake Examples¶
This page demonstrates how to manage files and folders in Microsoft Fabric OneLake using the CLI. OneLake provides unified data lake storage that's integrated across all Fabric experiences.
OneLake is the built-in data lake for Microsoft Fabric that provides a single, unified namespace for all your data. You can manage files and folders directly through the CLI for supported item types.
Navigation¶
Navigate to the Files section of a Lakehouse.
Navigate to the Tables section of a Lakehouse.
Navigate to a nested folder within the Files section.
OneLake Management¶
Check Folder Existence¶
Check if a specific directory exists in OneLake.
Check File Exists¶
Check if a specific file exists in OneLake.
Get File/Folder¶
Get File/Folder Details¶
Retrieve full metadata for a file or folder.
Query Specific Properties¶
Extract specific properties using JMESPath queries.
# Get first path item
fab get ws1.Workspace/lh1.Lakehouse/Files/datasets -q paths[0]
# Get complete object
fab get ws1.Workspace/lh1.Lakehouse/Files/datasets -q .
Export Metadata¶
Save metadata query results to local storage or OneLake.
# Export to local directory
fab get ws1.Workspace/lh1.Lakehouse/Files/datasets -q paths[0] -o /tmp/metadata
List OneLake Content¶
Items Supporting OneLake Folder Structure:
Display content for an item.
# List Files section in Lakehouse
fab ls ws1.Workspace/lh1.Lakehouse/Files
# List dbo Tables section in Warehouse
fab ls ws1.Workspace/wh1.Warehouse/Tables/dbo
# List Tables in SemanticModel
fab ls ws1.Workspace/sem1.SemanticModel/Tables
Create Folders¶
Create a folder in OneLake. Only supported for Files
in .Lakehouse
, Main
and Libs
folders in .SparkJobDefinition
Create Directory in Lakehouse Files¶
Create a new folder within the Files section of a Lakehouse.
Create Nested Directories¶
Create folder structures for organizing data.
fab create ws1.Workspace/lh1.Lakehouse/Files/raw-data/2024/january
fab create ws1.Workspace/lh1.Lakehouse/Files/processed-data/reports
Remove Files and Folders¶
Remove Folder¶
Delete a folder and its contents from OneLake.
Remove Specific File¶
Delete a specific file with force flag to skip confirmation.
Remove with Confirmation¶
Delete resources with interactive confirmation.
OneLake Operations¶
Copy Files Between Folders¶
Copy File with Same Name¶
Copy a file from one OneLake folder to another, maintaining the original filename.
Copy File with New Name¶
Copy a file to a different folder and rename it in the process.
fab cp ws1.Workspace/lh1.Lakehouse/Files/csv/data.csv ws1.Workspace/lh1.Lakehouse/Files/dest/renamed_data.csv
Upload Files to OneLake¶
Upload File with Same Name¶
Copy a local file to OneLake, keeping the original filename.
Upload File with New Name¶
Upload a local file to OneLake and rename it during the upload process.
Download Files from OneLake¶
Download File with Same Name¶
Download a file from OneLake to a local directory, maintaining the filename.
Download File with New Name¶
Download a file from OneLake and rename it locally.