Bash unable to create directory

2019-09-11 12:34发布

问题:

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 file or directory

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

回答1:

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