Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    /**
     * Delete directory you passed. the directory's child file and directory will be deleted too by recursive exploring.
     */
    public static void deleteAllFiles(File directory) {
        File[] files;

        files = directory.listFiles();
        files = files == null ? new File[0] : files;

        for (File file : files) {
            if (file.isDirectory())
                deleteAllFiles(file);
            else
                file.delete();
        }
        directory.delete();
    }
}