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 deleteFile(String fileName) {
        File f = new File(fileName);
        if (f.exists()) {
            if (f.isFile()) {
                f.delete();
            } else if (f.isDirectory()) {
                String[] filelist = f.list();
                for (int i = 0; i < filelist.length; i++) {
                    File readfile = new File(fileName + filelist[i]);
                    deleteFile(fileName + filelist[i]);
                }
            }
        }
    }
}