Java Directory Clean cleanDir(String path)

Here you can find the source of cleanDir(String path)

Description

clean Dir

License

Open Source License

Declaration

public static void cleanDir(String path) throws IOException 

Method Source Code


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

import java.io.File;

import java.io.IOException;

public class Main {
    public static void cleanDir(String path) throws IOException {

        File dir = new File(path);
        if (dir.exists()) {
            if (!dir.isDirectory()) {
                throw new IOException("Path is not a directory: " + path);
            }/*ww w . j  ava  2 s. c o m*/
            for (File file : dir.listFiles()) {
                file.delete();
            }
        }

    }
}

Related

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