次のディレクトリ構造があります。
Dir1
|___Dir2
|___Dir3
|___Dir4
|___File1.gz
|___File2.gz
|___File3.gz
サブディレクトリはネストされているだけで、ファイルは含まれていません
HDFS 上のディレクトリを再帰するために次を使用しようとしています。そのディレクトリ/*
がパスに追加されている場合は、addInputPath
arg[0] = "path/to/Dir1"; // given at command line
FileStatus fs = new FileStatus();
Path q = new Path(args[0]);
FileInputFormat.addInputPath(job,q);
Path p = new Path(q.toString()+"/*");
fs.setPath(p);
while(fs.isDirectory())
{
fs.setPath(new Path(p.toString()+"/*"));
FileInputFormat.addInputPath(job,fs.getPath());
}
しかし、コードがwhile
ループに入っていないようで、not a File
例外が発生します