Java File Path Delete deleteAllFilesInDir(File dir)

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

Description

delete All Files In Dir

License

Open Source License

Declaration

public static boolean deleteAllFilesInDir(File dir) 

Method Source Code


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

import java.io.File;

public class Main {
    public static boolean deleteAllFilesInDir(File dir) {
        if (dir.isDirectory()) {
            boolean result = true;
            File[] filelist = dir.listFiles();
            for (int i = 0; i < filelist.length; i++) {
                result &= deleteAllFilesInDir(filelist[i]);
            }/*  ww w.j  av  a  2  s  . c  o m*/
            return result;
        } else {
            return dir.delete();
        }
    }
}

Related

  1. deleteAllFiles(String directory)
  2. deleteAllFiles(String folder, String type)
  3. deleteAllFiles(Vector filesToDelete)
  4. deleteAllFilesAux(String input, File swapFolder)
  5. deleteAllFilesIn(String dir)
  6. deleteAllFilesInDirectory(String path)
  7. deleteAllFilesOnlyInDirectory(File startingDir)
  8. deleteAllFilesRecursively(String directoryName)
  9. deleteAndCreateFolder(String path)