1 获取路径
val output = new Path("hdfs://master:9000/output/");
val hdfs = org.apache.hadoop.fs.FileSystem.get(
new java.net.URI("hdfs://master:9000"), new org.apache.hadoop.conf.Configuration())
2 相关操作
// 删除输出目录
if (hdfs.exists(output)) hdfs.delete(output, true)
//遍历目录
val fs= hdfs.listStatus(output)
19 val listPath = FileUtil.stat2Paths(fs)
20 import org.apache.hadoop.fs.FileUtil
21 val listPath = FileUtil.stat2Paths(fs)
22 for(p<-listPath) println(p)