Java Folder Delete emptyFolder(File folder)

Here you can find the source of emptyFolder(File folder)

Description

empty Folder

License

Apache License

Declaration

public static void emptyFolder(File folder) 

Method Source Code


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

import java.io.*;

public class Main {
    public static void emptyFolder(File folder) {
        if (folder.isDirectory()) {
            File[] files = folder.listFiles();
            for (File file : files) {
                if (file.isDirectory()) {
                    emptyFolder(file);//from   w ww .  j  av a  2s  .  c  om
                } else {
                    file.delete();
                }
            }
        }
    }
}

Related

  1. emptyAndDelete(File fileOrDir)
  2. emptyDerbyTestDirectory(final String derbyTestDirectory)
  3. emptyFile(final String urlFile)
  4. emptyFile(String srcFilename)
  5. emptyFolder(File dir)
  6. emptyFolder(File folder)
  7. emptyFolder(File folder, boolean ignoreCannotDel)
  8. emptyFolder(File toEmpty)
  9. emptyFolder(final File folder)