Bash unable to create directory

2019-09-11 12:18发布

In docker, I want to copy a file README.md from an existing directory /opt/ibm/labfiles to a new one /input/tmp. I try this

hdfs dfs -put /opt/ibm/labfiles/README.md input/tmp 

to no effect, because there seems to be no /input folder in the root. So I try to create it:

hdfs dfs -mkdir /input
mkdir:'/input': File exists

However, when I ls, there is no input fileenter image description here or directory enter image description here

How can I create a folder and copy the file? Thank you!!

1条回答
手持菜刀,她持情操
2楼-- · 2019-09-11 12:39

Please try hdfs dfs -ls / if you want to see there is an input folder that exists in HDFS at the root.

You cannot cd into an HDFS directory

It's also worth mentioning that the leading slash is important. In other words,

This will try to put the file in HDFS at /user/<name>/input/tmp

hdfs dfs -put /opt/ibm/labfiles/README.md input/tmp 

While this puts the file at the root of HDFS

hdfs dfs -put /opt/ibm/labfiles/README.md /input/tmp 
查看更多
登录 后发表回答