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 void deleteEveryFile(File file) {
        if (file.exists()) {
            if (file.isFile()) {
                file.delete();
            } else if (file.isDirectory()) {
                File afile[] = file.listFiles();
                if (afile != null) {
                    for (int i = 0; i < afile.length; i++)
                        deleteEveryFile(afile[i]);

                    file.delete();
                } else {
                    file.delete();
                }
            }
        }

    }

    public static void deleteEveryFile(String s) {
        deleteEveryFile(new File(s));
    }
}