delete directory Recursive - Android java.io

Android examples for java.io:File Directory

Description

delete directory Recursive

Demo Code


//package com.java2s;

import java.io.File;

public class Main {
    public static void deleteRecursive(File fileOrDirectory) {
        if (fileOrDirectory.isDirectory()) {
            for (File child : fileOrDirectory.listFiles()) {
                deleteRecursive(child);//from www  .  j a va  2  s  . c o  m
            }
        }

        fileOrDirectory.delete();
    }
}

Related Tutorials