Java Directory Clean cleanDirectory(File currentDir)

Here you can find the source of cleanDirectory(File currentDir)

Description

Clean directory and it's files

License

LGPL

Parameter

Parameter Description
currentDir the current dir

Declaration

public static void cleanDirectory(File currentDir) 

Method Source Code


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

import java.io.File;

public class Main {
    /**//w w  w.  j a  v a 2 s.co  m
     * Clean directory and it's files
     *
     * @param currentDir
     *            the current dir
     */
    public static void cleanDirectory(File currentDir) {
        File[] files = currentDir.listFiles();
        for (File file : files) {
            file.delete();
        }
        currentDir.delete();
    }
}

Related

  1. cleanDir(final File dir, final String exclude)
  2. cleanDir(final String luceneDir)
  3. cleanDir(String dir)
  4. cleanDir(String directory)
  5. cleanDir(String path)
  6. cleanPath(String loc)
  7. cleanPath(String path)
  8. cleanPaths(String root, String rel, String name)
  9. clearDir(File dir, boolean clearsubdirs)