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);

    }

}
原文地址:https://www.cnblogs.com/Raodi/p/11054433.html