英文:
Databricks CLI copy command not copying folder but copied only files
问题
我使用Azure Databricks和Databricks CLI来管理它。当我尝试将一些本地文件夹和文件复制到Databricks DBFS时,首先复制了带有文件夹和文件的第一个文件夹(与本地相同)。但对于第二个文件夹,它只复制了其中的文件,而不是文件夹,所以看起来是这样的。
假设我的文件夹名为'animal',包含以下两个子文件夹,并且我尝试以递归方式复制animal文件夹。
animal文件夹包含以下子文件夹和其中的文件:
- animal\land\gorilla.txt
- animal\land\tiger.txt
- animal\land\lion.txt
animal文件夹包含以下子文件夹和其中的文件:
- animal\sea\fish.txt
- animal\sea\shark.txt
- animal\sea\whale.txt
在Databricks DBFS中保存如下:
- animal\land\gorilla.txt
- animal\land\tiger.txt
- animal\land\lion.txt
- animal\fish.txt
- animal\shark.txt
- animal\whale.txt
以下是我的命令,
databricks fs cp -r 'C:myname/work/animal/' dbfs:/earth/organism
我希望在Databricks DBFS中得到以下结果,
- /earth/organism/land/gorilla.txt(以及所有land文件)
- /earth/organism/sea/whale.txt(以及所有sea文件,但sea文件夹甚至不存在)
我做错了什么,有人可以纠正我吗?
英文:
I use Azure databricks and databricks CLI to manage it. When I try to copy some local folders and files to databricks DBFS, at first folder it copied with folder and files ( as same as local ). But for the second folders, it just copied files in it not the folder, so it looks something below.
Imagine my folder named 'animal' contains two subfolders like below and I tried to copy animal folder with recursive true.
animal folder contains below subfolders and files in it:
- animal\land\gorilla.txt
- animal\land\tiger.txt
- animal\land\lion.txt
animal folder contains below subfolders and files in it:
- animal\sea\fish.txt
- animal\sea\shark.txt
- animal\sea\whale.txt
Above are saved as below in databricks dbfs:
- animal\land\gorilla.txt
- animal\land\tiger.txt
- animal\land\lion.txt
- animal\fish.txt
- animal\shark.txt
- animal\whale.txt
Below is my command,
databricks fs cp -r 'C:myname/work/animal/' dbfs:/earth/organism
I expect something below in databricks dbfs,
- /earth/organism/land/gorilla.txt (and all landfiles)
- /earth/organism/sea/whale.txt (and all sea files but sea
folder not even exist )
What Iam doing wrong, Can someone correct me?
答案1
得分: 1
根据我的理解,在你的命令中:
databricks fs cp -r **'C:myname/work/animal/'** dbfs:/earth/organism
忽略字符串中的本地文件夹路径,尝试将文件夹及其子文件夹复制到DBFS。
我尝试了相同的操作:
C:\Users\xxxxx\Desktop\Animal>databricks fs cp -r C:/Users/xxxxxx/Desktop/Animal dbfs:/FileStore/tables/Animal/
在Databricks DBFS上:
英文:
As per my uderstanding In your command
databricks fs cp -r **'C:myname/work/animal/'** dbfs:/earth/organism
Ignore the local folder path in String and try copying the folder and sub folder into DBFS.
I have tried same.
C:\Users\xxxxx\Desktop\Animal>databricks fs cp -r C:/Users/xxxxxx/Desktop/Animal dbfs:/FileStore/tables/Animal/
At Databricks DBFS:
enter image description here
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论