Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.util.Arrays;
import java.util.Collection;

public class Main {
    public static int deleteFiles(Collection<File> files) {
        int n = 0;
        for (File file : files) {
            if (file.isDirectory()) {
                n += deleteFiles(Arrays.asList(file.listFiles()));
            }
            if (file.delete())
                n++;
        }
        return n;
    }
}