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

booleandelete(File path)
delete
if (null == path || !path.exists()) {
    return false;
boolean delete = false;
if (path.isDirectory()) {
    File[] files = path.listFiles();
    if (null != files && files.length > 0) {
        for (File file : files) {
...
booleandelete(File path)
delete
if (!path.exists())
    return false;
boolean ret = true;
if (path.isDirectory()) {
    for (File f : path.listFiles()) {
        ret = ret && delete(f);
return ret && path.delete();
voiddelete(File path)
deletes files and directories
if (path.exists()) {
    if (path.isDirectory()) {
        File files[] = path.listFiles();
        for (File file : files) {
            delete(file);
        path.delete();
    } else {
...
voiddelete(File path, String... exclude)
delete
List<String> excludedPaths = Arrays.asList(exclude);
File[] files = path.listFiles();
if (files != null) {
    for (File file : files) {
        if (!excludedPaths.contains(file.getName())) {
            if (file.isDirectory()) {
                delete(file);
            file.delete();
voiddelete(final File path)
delete
final String[] files = path.list();
String parentPath = path.getPath();
for (final String name : files) {
    final File file = new File(parentPath, name);
    if (file.isDirectory()) {
        delete(file);
    file.delete();
...
booleandelete(String fileNameWithFullPath)
Deletes a File from an url.
File file = new File(fileNameWithFullPath);
return file.delete();
booleandelete(String filePath)
delete
File file = new File(filePath);
return delete(file);
voiddelete(String filePath)
delete
boolean result = new File(filePath).delete();
if (!result) {
    throw new IOException("Delete " + filePath + " failed!");
booleandelete(String filePath)
delete
File file = new File(filePath);
return file.delete();
booleandelete(String filePath)
delete
return delete(new File(filePath));