kgui
kgui

Reputation: 4163

Moving Files in Hadoop using API

Is it possible to move files in hadoop using the FileSystem class https://hadoop.apache.org/docs/r2.7.1/api/index.html?org/apache/hadoop/fs/FileSystem.html or similar?

Upvotes: 0

Views: 241

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191973

Yes, it is possible.

For a MapReduce copy that is faster than hadoop fs -cp, look at the DistCp source code

Or if you actually want to move a file hadoop fs -mv source code . Note: "move" is actually a "rename" in HDFS.

FileSystem#rename is what you want.

Upvotes: 1

Related Questions