Databricks CLI复制命令未复制文件夹,只复制了文件。

huangapple go评论58阅读模式
英文:

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上:
Databricks CLI复制命令未复制文件夹,只复制了文件。

英文:

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/

Databricks CLI复制命令未复制文件夹,只复制了文件。
At Databricks DBFS:
Databricks CLI复制命令未复制文件夹,只复制了文件。

enter image description hereDatabricks CLI复制命令未复制文件夹,只复制了文件。

huangapple
  • 本文由 发表于 2023年6月8日 03:14:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76426447.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定