HDFS文件夹删除

    /**
     *  文件夹删除
     * @throws IOException
     * @throws InterruptedException
     * @throws URISyntaxException
     */
    @Test
    public void testDelete() throws IOException, InterruptedException, URISyntaxException{

        // 1 获取文件系统
        Configuration configuration = new Configuration();
        FileSystem fs = FileSystem.get(new URI("hdfs://192.168.2.210:9000"), configuration, "atguigu");

        // 2 执行删除
        fs.delete(new Path("/0508/"), true);

        // 3 关闭资源
        fs.close();
    }

 

你可能感兴趣的:(HDFS)