Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

public class Main {

    public static boolean DeleteFile(File file) {
        if (file.isFile()) {

            return file.delete();
        }
        if (file.isDirectory()) {
            File[] childFile = file.listFiles();
            if (childFile == null || childFile.length == 0) {

                return file.delete();
            }
            for (File f : childFile) {
                DeleteFile(f);
            }
            return file.delete();
        }
        return false;
    }
}