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

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!