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:
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:
To copy a file in HDFS to a different location:
bashhadoop 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.To copy a directory in HDFS to a different location:
bashhadoop fs -cp /user/username/source_directory /user/username/destination_directory/
This command copies the entire
source_directory
to thedestination_directory
.To copy a file in HDFS and rename it in the destination:
bashhadoop fs -cp /user/username/original_file.txt /user/username/renamed_file.txt
This command copies
original_file.txt
to the destination but renames it asrenamed_file.txt
.To copy a file from one user’s directory to another user’s directory:
bashhadoop fs -cp /user/user1/data.txt /user/user2/
This command copies
data.txt
fromuser1
‘s directory touser2
‘s directory.
Hadoop Training Demo Day 1 Video:
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