cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read available file after downloading

sharma_kamal
New Contributor III

After downloading a file using `wget`, I'm attempting to read it by spark.read.json.

I am getting error:
 
PATH_NOT_FOUND - Path does not exist: dbfs:/tmp/data.json. SQLSTATE: 42K03
File <command-3327713714752929>, line 2
 
I have checked the file do exist. I attempted to copy the file to DBFS, but encountered difficulties.
Attaching relevant screenshots here.  

Could someone please help me identify any errors or issues in my approach?

Thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions

ThomazRossito
Contributor

Hi, 

Perform a test with the code below


Code layout:
dbutils.fs.cp
("file:///<file source directory>/<your file extension>""dbfs:/<file destination directory>/", True)
 
Code example:
dbutils.fs.cp("file:///tmp/file.csv", "dbfs:/tmp/"True)
Att.
Thomaz Antonio Rossito Neto
Master Data Specialist - Data Architect | Data Engineer @ CI&T

View solution in original post

3 REPLIES 3

ThomazRossito
Contributor

Hi, 

Perform a test with the code below


Code layout:
dbutils.fs.cp
("file:///<file source directory>/<your file extension>""dbfs:/<file destination directory>/", True)
 
Code example:
dbutils.fs.cp("file:///tmp/file.csv", "dbfs:/tmp/"True)
Att.
Thomaz Antonio Rossito Neto
Master Data Specialist - Data Architect | Data Engineer @ CI&T

Thank you. It worked!

Ayushi_Suthar
Databricks Employee
Databricks Employee

Hi @sharma_kamal , Good Day! 

Could you please try the below code suggested by @ThomazRossito , it will help you. 

Also please refer to the below document to work with the files on Databricks: 

https://docs.databricks.com/en/files/index.html

Please let me know if this helps and leave a like if you find this information useful. Follow-ups are appreciated.
Kudos
Ayushi

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