Hadoop fs -cp , says file does not exist? Hadoop fs -cp , says file does not exist? hadoop hadoop

Hadoop fs -cp , says file does not exist?


cp is used when you wish to copy data from one HDFS location to another HDFS location. But you intend to copy data from your local FS to HDFS. To copy data from local FS to HDFS you can use either put or copyFromLocal.

If you really wish to do it using cp then you must specify the complete path along with the scheme. Say,

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

cp by default assumes the scheme to be hdfs://

But why would you do that, when you have put and copyFromLocal??

HTH


For copying files from local to hdfs, Following command should be used

hadoop fs -copyFromLocal $HOME/fs/new.txt $HOME/hdfs

For cat hdfs file you may use the following command

hadoop fs -cat $HOME/hdfsnew.txt