Java Delete Directory deleteDirectory(File file)

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

Description

delete Directory

License

Open Source License

Declaration

public static void deleteDirectory(File file) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    public static void deleteDirectory(File file) {
        try {/*from  ww w. j  av  a 2 s.c o m*/
            File[] files = file.listFiles();
            if (files != null)
                for (int i = 0; i < files.length; i++) {
                    deleteDirectory(files[i]);
                }
        } catch (Exception e) {
        }
        try {
            file.delete();

        } catch (Exception e) {
        }
    }
}

Related

  1. deleteDirectory(File f)
  2. deleteDirectory(File file)
  3. deleteDirectory(File file)
  4. deleteDirectory(File file)
  5. deleteDirectory(File file)
  6. deleteDirectory(File file)
  7. deleteDirectory(File file)
  8. deleteDirectory(File fileOrDir)
  9. deleteDirectory(File root)