cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How do I get files into /FileStore to be accessed with /files from within my notebooks?

cfregly
Contributor
 
3 REPLIES 3

cfregly
Contributor

For context, DBFS exposes a special location called

/FileStore
as follows:

display(dbutils.fs.ls("/FileStore"))

This location can be accessed by HTML, JavaScript, and CSS at its equivalent

/files
as follows:

<script src="/files/..."/> 

In order to get assets into

dbfs:/FileStore
, you can first copy it locally from a url as follows:

import sys.process._ 
"wget -P /tmp http://d3js.org/d3.v2.min.js"; !!

You can verify that this file was downloaded as follows:

display(dbutils.fs.ls("file:/tmp/d3.v2.min.js"))

Using

file:/
with DBFS accesses the local filesystem.

Then use dbutils to copy the local file into the mount as follows:

dbutils.fs.mkdirs("/FileStore/customjs") 
dbutils.fs.cp("file:/tmp/d3.v2.min.js", "/FileStore/customjs/d3.v2.min.js")

You can verify that the file was copied as follows:

display(dbutils.fs.ls("/FileStore/customjs"))

This newly-downloaded JavaScript file can now be accessed from HTML as follows:

<script src="/files/customjs/d3.vs.min.js"/>

nick1868
New Contributor II

One follow on question. Is it possible to make a resource public.

I am generating a html file which I would like to be available to anyone. Is it possible to "publish" this html page like I have published a dashboard. I can access it when I log into my databricks account but I would like a public URL with no login required.

easimadi
New Contributor II

Hello Pls help (Not an Answer),

How do I download complete csv (>1000) result file in FileStore unto my laptop?

I was trying to follow this instruction set SQL tutorial (Download All SQL - scala)

0693f000007OrmnAAC

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