Java File Delete delete(File dir)

Here you can find the source of delete(File dir)

Description

delete

License

Apache License

Declaration

public static void delete(File dir) 

Method Source Code

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

import java.io.File;

public class Main {
    public static void delete(File dir) {
        if (!dir.isDirectory()) {
            dir.delete();//w w w.  j a  va 2 s.c o  m
            return;
        }
        String[] entries = dir.list();
        for (String s : entries) {
            File currentFile = new File(dir.getPath(), s);
            if (currentFile.isDirectory()) {
                delete(currentFile);
            }
            currentFile.delete();
        }
        dir.delete();
    }
}

Related

  1. clearFileOrDir(File file)
  2. delete(File aFile)
  3. delete(File classDir)
  4. delete(File current)
  5. delete(File dir)
  6. delete(File dir)
  7. delete(File f)
  8. delete(File f)
  9. delete(File f)