hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Susheel Kumar Gadalay <skgada...@gmail.com>
Subject Re: FileUtil Copy example
Date Thu, 25 Sep 2014 05:14:25 GMT
I solved it like this. This will move a file from one location to
another location.

FileStatus[] fstatus = FileSystem.listStatus(new Path(<Old HDFS directory>));
for (int i=0; i<fstatus.length; i++) {
   if (fstatus[i].isFile()) {
      if (fstatus[i].getPath().getName().substring(0,
10).matches("<some name>"))
         FileSystem.rename(new Path(<Old HDFS Directory> + "/" +
fstatus[i].getPath().getName()), new Path(<New HDFS Directory> + "/" +
fstatus[i].getPath().getName()));
   }
}

I don't think copy individual file API is available.


On 9/23/14, Susheel Kumar Gadalay <skgadalay@gmail.com> wrote:
> Can somebody give a good example of using Hadoop FileUtil API to copy
> set of files from one directory to another directory.
>
> I want to copy only a set of files not all files in the directory and
> also I want to use wild character like part_r_*.
>
> Thanks
> Susheel Kumar
>

Mime
View raw message