/** * @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读取目录下的文件列表
猜你喜欢
转载自qq346359669.iteye.com/blog/2173491
今日推荐
周排行