Hi @Gabriel-2005
Welcome to Microsoft Q&A platform.
Thank you for sharing your query! Based on your provided code, it seems that the directory path you are using (file:/databricks/driver/training_runs
) is not part of the Databricks File System (DBFS) but rather a general storage path.
Accessing Files in General Storage Path
Databricks does not provide UI support for viewing files in general storage paths like this. However, you can programmatically list the contents of the path using one of the following approaches:
# Option 1: Using dbutils
dbutils.fs.ls("file:/databricks/driver/training_runs/<your_run_id>/")
# Option 2: Using os module
import os
print(os.listdir("/databricks/driver/training_runs/<your_run_id>/"))
Viewing Files in the Databricks UI
If you prefer to browse and manage these files through the Databricks UI, consider writing them to the DBFS instead.
Step 1: Enable the DBFS Browser
- Navigate to Admin Console → Workspace Settings → DBFS File Browser and enable it.
- Refresh your workspace to apply the changes.
Step 2: Update Your Code to Use DBFS Path
Replace your current file path with a DBFS-compatible path, as shown below:
run_directory = f"/FileStore/training_runs/demo"
dbutils.fs.mkdirs(f"dbfs:{run_directory}")
with open(f"/dbfs{run_directory}/file.txt", "w") as file_:
file_.write("Hello world :)")
Once the file is written, navigate to Data → Browse DBFS → FileStore, and you should see the folder and its contents.
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.