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

voiddeleteFiles(String actionPath, String filePath)
delete Files
String path = actionPath + File.separator + filePath;
File deleteFile = new File(path);
if (deleteFile.isFile() && deleteFile.exists()) {
    deleteFile.delete();
booleandeleteFiles(String filePath)
delete Files
File f = new File(filePath);
if (!f.exists()) {
    return true;
if (f.isDirectory()) {
    File[] files = f.listFiles();
    if (files != null) {
        for (int i = 0, len = files.length; i < len; i++) {
...
voiddeleteFilesInDirectory(File path)
delete Files In Directory
if (path.exists()) {
    File[] files = path.listFiles();
    for (int i = 0; i < files.length; i++) {
        if (!files[i].isDirectory()) {
            files[i].delete();
voiddeleteFilesInDirectory(String pathname)
Deletes all files from a directory except PLACEHOLDER_FILENAME.
FilenameFilter filenameFilter = new FilenameFilter() {
    public boolean accept(File dir, String name) {
        return (!name.equals(PLACEHOLDER_FILENAME));
};
File directory = new File(pathname);
File[] directoryListing = directory.listFiles(filenameFilter);
if (directoryListing == null) {
...
BooleandeleteFilesinPath(File pBaseDir, String pFileName)
delete Filesin Path
Collection listFilesToRemove = findFiles(pBaseDir, pFileName);
Integer objectif = listFilesToRemove.size();
Integer resultat = 0;
Iterator it = listFilesToRemove.iterator();
while (it.hasNext()) {
    File current = (File) it.next();
    Boolean result = current.delete();
    if (result.booleanValue()) {
...
voiddeleteFilesRecursive(final File path)

Deletes files recursively.

if (path.isDirectory()) {
    final File[] files = path.listFiles();
    for (File file : files)
        deleteFilesRecursive(file);
path.delete();
voiddeleteFileSystemDirectory(String dirPath)
delete File System Directory
deleteFileSystemDirectory(new File(dirPath));
voiddeleteFileSystemDirectory(String dirPath)
delete File System Directory
deleteFileSystemDirectory(new File(dirPath));
voiddeleteFileWithoutException(final String path)
delete File Without Exception
try {
    new File(path).delete();
} catch (final Throwable t) {
booleandeleteFileWithSuffix(String path, String suffix)
Delete the file by a given file path with specific suffix.
boolean flag = false;
File file = new File(path);
if (file.isFile() && file.exists() && file.getName().endsWith(suffix)) {
    if (file.delete()) {
        flag = true;
return flag;
...