Java Delete Directory deleteDirectory(File directory)

Here you can find the source of deleteDirectory(File directory)

Description

Deletes directory and its content

License

Open Source License

Declaration

public static void deleteDirectory(File directory) 

Method Source Code


//package com.java2s;
import java.io.File;

public class Main {
    /**/* ww w .  ja v a  2 s  . com*/
     * Deletes directory and its content
     */
    public static void deleteDirectory(File directory) {
        for (File file : directory.listFiles()) {
            if (file.isDirectory())
                deleteDirectory(file);
            else
                file.delete();
        }
        directory.delete();
    }
}

Related

  1. deleteDirectory(File directory)
  2. deleteDirectory(File directory)
  3. deleteDirectory(File directory)
  4. deleteDirectory(File directory)
  5. deleteDirectory(File directory)
  6. deleteDirectory(File directory, boolean ignoreErrors)
  7. deleteDirectory(File f)
  8. deleteDirectory(File f)
  9. deleteDirectory(File f)