/**
* @see 读取path下的所有文件
* @param path
* @return
* @throws IOException
*/
public static String[] getFileList(String path) throws IOException{
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
List<String> files = new ArrayList<String>();
Path s_path = new Path(path);
if(fs.exists(s_path)){
for(FileStatus status:fs.listStatus(s_path)){
files.add(status.getPath().toString());
}
}
fs.close();
return files.toArray(new String[]{});
}
hadoop读取目录下的文件列表
最新推荐文章于 2022-03-15 08:06:38 发布