公告:    欢迎来到王者★孤傲博客主页,若有问题敬请留言 !     没有大量的积累和感悟,是不会把事情做好的, 只有不停的进取,才能够不丢人! Copyright © 2016-2020 RaodiBlogs. All rights reserved.

DeleteFile



import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
/***
 * 
 * @author 
 *
 */
public class DeleteFile {

    public static void main(String[] args) throws URISyntaxException, IOException, InterruptedException {
        Configuration conf=new Configuration();
           //注意修改为自己的IP
           URI uri=new URI("hdfs://192.168.1.100:9000");
           FileSystem fs=FileSystem.get(uri,conf,"hadoop");
           //HDFS file                            
           Path path=new Path("/user/hadoop/myfile");
           fs.delete(path,true);

    }

}
posted @ 2019-06-19 20:24  王者★孤傲  阅读(216)  评论(0编辑  收藏  举报
……