I have a file that I can see in my current working directory:
%sh
pwd
ls
The output of above is:
/databricks/driver
conf
sample.csv
logs
I want to move the sample.csv
file from here to Workspace/Shared
directory for which I am using dbutils.fs.mv
:
dbutils.fs.mv("dbfs:/databricks/driver/sample.csv","dbfs:/Workspace/Shared/")
but this gives error as java.is.FileNotFoundException:dbfs:/databricks/driver/sample.csv
How do I resolve this error?
when you're executing command on via %sh
, it's executed on the driver node, so file is local to it. But you're trying to copy file as it's on the DBFS already, and then it isn't found. You need to change scheme from dbfs
to file
to point to the file on the driver node, like this:
dbutils.fs.mv("file:///databricks/driver/sample.csv","dbfs:/Workspace/Shared/")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.