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?
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.