What is -cp command in hadoop? How it works?

0 votes
Copying file from one hdfs location to another using -cp command

Command - hadoop fs -cp -p /user/cloudera/data/new.txt /user/cloudera/data1 (Without creating 'data1' directory before using above command)

When -ls command is used to see the file in the directory data1- I do not see the file.

Is it mandatory to create a directory and then copy?
As with the current case explained above I did not get any error.
Oct 17, 2018 in Big Data Hadoop by Neha
• 6,300 points
883 views

1 answer to this question.

0 votes
/user/cloudera/data1 is not a directory, it is the file that you copied. That is why there is no error.

If you want a directory containing that file, then yes, you need to hadoop fs -mkdir
answered Oct 17, 2018 by Frankie
• 9,810 points

Related Questions In Big Data Hadoop

0 votes
11 answers
0 votes
1 answer

What is the difference in DistCP command and Sqoop command in Hadoop?

Both the distCP (Distributed copy in Hadoop) ...READ MORE

answered Apr 11, 2019 in Big Data Hadoop by Gitika
• 42,480 points
211 views
0 votes
1 answer

I have to ingest in hadoop cluster large number of files for testing , what is the best way to do it?

Hi@sonali, It depends on what kind of testing ...READ MORE

answered Jul 7 in Big Data Hadoop by MD
• 66,980 points
177 views
+1 vote
1 answer

Is it necessary to use Zookeeper in Hadoop Stack?

ZooKeeper is a centralized service for maintaining ...READ MORE

answered Mar 27, 2018 in Big Data Hadoop by Ashish
• 2,650 points
253 views
+1 vote
2 answers

What does hadoop fs -du command gives as output?

du command is used for to see ...READ MORE

answered Jul 23, 2019 in Big Data Hadoop by Lokesh Singh
2,603 views
0 votes
1 answer

How can I write text in HDFS using CMD?

Hadoop put & appendToFile only reads standard ...READ MORE

answered Apr 27, 2018 in Big Data Hadoop by Shubham
• 13,450 points
253 views
0 votes
1 answer

What is the command to find the free space in HDFS?

You can use dfsadmin which runs a ...READ MORE

answered Apr 29, 2018 in Big Data Hadoop by Shubham
• 13,450 points
638 views
0 votes
1 answer

How to find the used cache in HDFS

hdfs dfsadmin -report This command tells fs ...READ MORE

answered May 4, 2018 in Big Data Hadoop by Shubham
• 13,450 points
709 views
0 votes
1 answer

What is Modeling data in Hadoop and how to do it?

I suggest spending some time with Apache ...READ MORE

answered Sep 19, 2018 in Big Data Hadoop by Frankie
• 9,810 points
530 views
0 votes
1 answer

What is Custom partitioner in Hadoop? How to write partition function ?

Don't think that in Hadoop the same ...READ MORE

answered Sep 18, 2018 in Big Data Hadoop by Frankie
• 9,810 points
621 views