Java File Path Delete deleteAllFile(final File dir)

Here you can find the source of deleteAllFile(final File dir)

Description

delete All File

License

Open Source License

Declaration

private static boolean deleteAllFile(final File dir) 

Method Source Code

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

import java.io.File;

public class Main {
    private static boolean deleteAllFile(final File dir) {
        boolean deleted = false;
        if (dir.exists()) {
            File[] files = dir.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory()) {
                    deleteAllFile(files[i]);
                } else {
                    deleted = files[i].delete();
                }//from   ww  w.  ja  va2 s .  c om
            }

        }
        return deleted;
    }
}

Related

  1. delete(String path)
  2. delete(String path)
  3. deleteAll(File path)
  4. deleteAll(File path)
  5. deleteAll(File path)
  6. deleteAllFile(String directory)
  7. deleteAllFile(String folderPath)
  8. deleteAllFile(String path)
  9. deleteAllFile(String path)