String hiveIP = "hdfs://ip:端口号";
Configuration config = new Configuration();
config.set("fs.defaultFS",hiveIP);
config.set("fs.hdfs.impl",org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
fs = FileSystem.get(config);
FileStatus[] statuses = fs.listStatus(new Path("文件夹地址"));
for (FileStatus status : statuses) {
boolean delete = fs.delete(status.getPath(), true);//删除
}
版权声明:本文为weixin_44309421原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。