英文:
java.io.FileNotFoundException on local databricks directory but directory exists
问题
我正在尝试在Databricks中从一个位置复制一个目录到另一个位置。
dbutils.fs.cp("/path/to/directory", "new_path/to/directory")
在运行之前,我确认目录存在:
folders <- list.folders("/path/to/", full.names = TRUE)
print(folders)
尽管已确认存在/path/to/directory目录,但我收到以下错误:
java.io.FileNotFoundException: /path/to/directory
英文:
I am trying to copy a directory in databricks from one location to another
dbutils.fs.cp("/path/to/directory", "new_path/to/directory")
Prior to running this I confirm the directory exists:
folders <- list.folders("/path/to/", full.names = TRUE)
print(folders)
I receive this error despite /path/to/directory being confirmed as existing:
java.io.FileNotFoundException: /path/to/directory
答案1
得分: 1
如果您不指定模式,那么假定为 dbfs:
,而您正试图将本地文件复制到DBFS。在使用本地文件时,您需要指定 file:
模式:
将本地文件复制到DBFS:
dbutils.fs.cp("file:/path/to/directory", "new_path/to/directory")
英文:
If you don't specify the schema, then it's assumed dbfs:
, while you're trying to copy local file to DBFS. You need to specify file:
schema when working with local files:
To copy local file to DBFS:
dbutils.fs.cp("file:/path/to/directory", "new_path/to/directory")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论