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,040 points
969 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,350 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,810 points
50 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
• 68,480 points
255 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
• 68,480 points
872 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 in Big Data Hadoop by Gitika
• 25,420 points
78 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,350 points
515 views
0 votes
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
• 10,800 points
3,589 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
18,520 views
0 votes
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,280 points
1,337 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,350 points
889 views
0 votes
5 answers