Java Utililty Methods Folder Delete

List of utility methods to do Folder Delete

Description

The list of methods to do Folder Delete are organized into topic(s).

Method

voidemptyFolder(File folder)
Removes a folder's contents
deleteFolder(folder, true);
intemptyFolder(File folder, boolean ignoreCannotDel)
empty Folder
int counter = 0;
if (folder.exists() && folder.isDirectory()) {
    File[] child = folder.listFiles();
    for (int i = 0; i < child.length; i++) {
        File file = child[i];
        if (file.isDirectory())
            counter += emptyFolder(file, ignoreCannotDel);
        boolean result = file.delete();
...
voidemptyFolder(File toEmpty)
empty Folder
for (File current : toEmpty.listFiles()) {
    if (current.isDirectory()) {
        emptyFolder(current);
    current.delete();
voidemptyFolder(final File folder)
empty Folder
deleteFolder(folder);
if (!folder.mkdirs()) {
    throw new IOException(String.format("Could not create empty folder %s", folder));
booleanemptyFolder(final File folder)
Recursively deletes whole content of the given folder.
if (!folder.isDirectory()) {
    return true;
File[] files = folder.listFiles();
boolean result = true;
for (int i = 0; i < files.length; i++) {
    File file = files[i];
    if (file.isDirectory()) {
...