Moving files in Hadoop using the Java API

0 votes
How can I move a file in HDFS from one directory to another with the help of JAVA APIs. The java Filesystem class moves the file in local file system. But I want to move the File across the HDFS.

In HDFS I have to read the file as input streams and then remove the old copy.
Apr 15, 2018 in Big Data Hadoop by coldcode
• 2,090 points
2,674 views

1 answer to this question.

0 votes
I would recommend you to use FileSystem.rename(). It renames the src Path to the destination path.
answered Apr 15, 2018 by Shubham
• 13,490 points

Related Questions In Big Data Hadoop

0 votes
1 answer

What are the prerequisites to learn Hadoop in java perspective?

In my day job, I've just spent ...READ MORE

answered Oct 11, 2018 in Big Data Hadoop by Frankie
• 9,830 points
785 views
0 votes
1 answer

Hadoop HDFS: Java API to move files to hdfs

You can use the FileUtil api to do this. Example: Configuration ...READ MORE

answered Nov 19, 2018 in Big Data Hadoop by Omkar
• 69,220 points
4,124 views
+1 vote
1 answer

How to read HDFS and local files with the same code in Java?

You can try something like this: ​ ...READ MORE

answered Nov 22, 2018 in Big Data Hadoop by Omkar
• 69,220 points
4,776 views
0 votes
0 answers

How to import Flat files in Hadoop using sqoop?

It is possible to import data between ...READ MORE

Apr 9, 2019 in Big Data Hadoop by Gitika
• 65,770 points
853 views
0 votes
1 answer

Hadoop giving java.io.IOException, in mkdir Java code.

I am not sure about the issue. ...READ MORE

answered May 3, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,547 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
11,033 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
108,853 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
4,616 views
0 votes
1 answer

How do I include all the Hadoop dependencies using Maven?

This is a dependency mismatch error. I ...READ MORE

answered Apr 10, 2018 in Big Data Hadoop by Shubham
• 13,490 points
6,504 views
0 votes
5 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP