Java Utililty Methods File Path Delete

List of utility methods to do File Path Delete

Description

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

Method

voiddeleteFolder(File path)
delete Folder
if (path.isDirectory()) {
    for (File file : path.listFiles()) {
        file.delete();
    path.delete();
voiddeleteFolder(File path)
delete Folder
if (path.isDirectory()) {
    for (File sub : path.listFiles()) {
        deleteFolder(sub);
if (!path.delete()) {
    throw new IllegalStateException("Can't delete " + path.getAbsolutePath());
voiddeleteFolder(String filePath)
delete Folder
File file = new File(filePath);
if (file.exists()) {
    if (file.isFile()) {
        file.delete();
    } else if (file.isDirectory()) {
        File[] files = file.listFiles();
        for (int i = 0; i < files.length; ++i) {
            deleteFolder(files[i]);
...
voiddeleteFolder(String folderPath)
delete Folder
deleteFolder(folderPath, false);
voiddeleteFolder(String folderPath)
delete Folder
try {
    deleteAllFile(folderPath);
    String filePath = folderPath;
    filePath = filePath.toString();
    java.io.File myFilePath = new java.io.File(filePath);
    myFilePath.delete();
} catch (Exception e) {
voiddeleteFolder(String folderPath)
delete Folder
File file = new File(folderPath);
if (!file.exists()) {
    return;
if (!recursiveDeleteDirContenteleteDir(file)) {
    System.err.println("Failed to clean up old resources in " + folderPath
            + " while setting up additional test resources.");
voiddeleteFolder(String path)
delete Folder
File file = new File(path);
if (file.exists()) {
    if (file.isFile()) {
        deleteFile(path);
    } else {
        deleteDirectory(path);
booleandeleteFolder(String path)
delete Folder
return deleteFolder(new File(path));
booleandeleteFolder(String path)
Removes the specified folder path
if (!path.endsWith(File.separator)) {
    path = path + File.separator;
File f = new File(path);
if (f.exists() && f.isDirectory()) {
    File[] files = f.listFiles();
    for (int i = 0; i < files.length; i++) {
        if (files[i].isFile()) {
...
voiddeleteFolder(String path)
delete Folder
final File delFolder = new File(path);
if (!(delFolder.delete())) {
    throw new IOException("Could not delete temp folder: " + path);