HDFS Copy

Share

                                HDFS Copy

In Hadoop, you can use the hadoop fs -cp command to copy files or directories from one location to another within the Hadoop Distributed File System (HDFS). This command allows you to duplicate data within HDFS or move it to a different location. Here’s how you can use it:

The basic syntax of the hadoop fs -cp command is as follows:

bash
hadoop fs -cp <source-path> <destination-path>
  • <source-path>: This is the source path in HDFS for the file or directory you want to copy.

  • <destination-path>: This is the destination path in HDFS where you want to copy the data.

Here are some examples of using the hadoop fs -cp command:

  1. To copy a file in HDFS to a different location:

    bash
    hadoop fs -cp /user/username/file.txt /user/username/new_directory/

    This command copies the file /user/username/file.txt to the /user/username/new_directory/ directory.

  2. To copy a directory in HDFS to a different location:

    bash
    hadoop fs -cp /user/username/source_directory /user/username/destination_directory/

    This command copies the entire source_directory to the destination_directory.

  3. To copy a file in HDFS and rename it in the destination:

    bash
    hadoop fs -cp /user/username/original_file.txt /user/username/renamed_file.txt

    This command copies original_file.txt to the destination but renames it as renamed_file.txt.

  4. To copy a file from one user’s directory to another user’s directory:

    bash
    hadoop fs -cp /user/user1/data.txt /user/user2/

    This command copies data.txt from user1‘s directory to user2‘s directory.

Hadoop Training Demo Day 1 Video:

 
You can find more information about Hadoop Training in this Hadoop Docs Link

 

Conclusion:

Unogeeks is the No.1 IT Training Institute for Hadoop Training. Anyone Disagree? Please drop in a comment

You can check out our other latest blogs on Hadoop Training here – Hadoop Blogs

Please check out our Best In Class Hadoop Training Details here – Hadoop Training

💬 Follow & Connect with us:

———————————-

For Training inquiries:

Call/Whatsapp: +91 73960 33555

Mail us at: info@unogeeks.com

Our Website ➜ https://unogeeks.com

Follow us:

Instagram: https://www.instagram.com/unogeeks

Facebook:https://www.facebook.com/UnogeeksSoftwareTrainingInstitute

Twitter: https://twitter.com/unogeeks


Share

Leave a Reply

Your email address will not be published. Required fields are marked *