https://delta.io logo
#random
Title
d

Divyansh Jain

08/03/2023, 3:46 AM
Hi All, Is there any way to copy Databricks Notebook from Workspace to DBFS. Please help.
c

Christopher Grant

08/03/2023, 4:41 PM
i'm unsure if copying directly and in one step is possible, but in steps and using an intermediary should be fine. you can export a notebook, then upload the notebook to DBFS
would recommend using the new cli (version 0.200+)
w

Winston LAI

08/07/2023, 12:39 PM
Have you tried dbutils.fs.cp() to copy the path of the notebook and paste it to the DBFS destination path? If it doesn't work, then yeah I think Christopher's answer is what I would do, too. You may try his nice advice!
Great to hear that your problem has been resolved. Just for sharing, I found another potential solution as well. You can use the Databricks CLI to move a notebook from the workspace to DBFS. Here is an example command that you can use:
Copy code
databricks workspace export_dir /Users/user@example.com/notebooks/my_notebook.py /mnt/my_mount_point/my_notebook.py
This command exports the notebook
my_notebook.py
from the workspace directory
/Users/user@example.com/notebooks/
to the DBFS mount point
/mnt/my_mount_point/
. You can replace
my_notebook.py
with the name of your notebook and
/Users/user@example.com/notebooks/
with the path to your notebook in the workspace. You can find more information about this command and other Databricks CLI commands in the [official documentation](https://docs.databricks.com/dev-tools/cli/workspace-cli.html#workspace-cli).
d

Divyansh Jain

08/07/2023, 1:11 PM
Thanks for sharing @Winston LAI!
👍 1