Hadoop fs -cp, said that the file does not exist?

The new.txt file is certain; I don’t know why when I try to enter the hdfs directory, it says the file does not exist.

deepak@deepak:/$cd $HOME/fs
deepak@deepak:~/fs$ls
new.txt
deepak@deepak:~/fs$cat new.txt
an apple a day keeps the doctor away
deepak@deepak:~/fs$hadoop fs -cp $HOME/fs/new.txt $HOME/hdfs
cp: File does not exist : /home/deepak/fs/new.txt
deepak@deepak:~/fs$

PS: I have created a directory called hdfs:

deepak@deepak:~/fs$hadoop fs -mkdir $HOME/hdfs
mkdir: cannot create directory /home/deepak/hdfs: File exists

< div class="content-split">

When you want to copy data from one HDFS location to another HDFS location, you will use cp. But you plan to transfer data from local FS Copy to HDFS. To copy data from local FS to HDFS, you can use put or copyFromLocal.

If you really want to use cp to do this, you must specify the full path and the scheme. Say,

hadoop fs -cp file:///Users/miqbal1/date.txt /

By default, cp assumes that the scheme is hdfs ://

But why would you do this when you put put and copyFromLocal?

HTH

The new.txt file is certain; I don’t know why when I try to enter the hdfs directory, it says the file does not exist.

deepak@deepak:/$cd $HOME/fs
deepak@deepak:~/fs$ls
new.txt
deepak@deepak:~/fs$cat new.txt
an apple a day keeps the doctor away
deepak@deepak:~/fs$hadoop fs -cp $HOME/fs/new.txt $HOME /hdfs
cp: File does not exist: /home/deepak/fs/new.txt
deepak@deepak:~/fs$

PS: I have created a name The directory for hdfs:

deepak@deepak:~/fs$hadoop fs -mkdir $HOME/hdfs
mkdir: cannot create directory /home/deepak/hdfs : File exists

When you want to copy data from one HDFS location to another HDFS location, you will use cp. But you intend to copy data from local FS Copy to HDFS. To copy data from local FS to HDFS, you can use put or copyFromLocal.

If you really want to use cp to do this, you must specify the full path and the scheme. Say,

hadoop fs -cp file:///Users/miqbal1/date.txt /

By default, cp assumes that the scheme is hdfs ://

But why would you do this when you put put and copyFromLocal?

HTH

Leave a Comment

Your email address will not be published.