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

voiddelFile(String filePath)
del File
File picFile = new File(filePath);
if (picFile.exists()) {
    picFile.delete();
picFile = null;
voiddelFile(String filePath, String fileName)
del File
try {
    File file = new File(filePath + fileName);
    file.delete();
} catch (Exception e) {
    System.err.println("delete File error");
    e.printStackTrace();
booleandelFile(String filePathAndName)
delete file
try {
    File file = new File(filePathAndName);
    return file.delete();
} catch (Exception e) {
    System.out.println("delete file failed");
    e.printStackTrace();
    return false;
voiddelFile(String filePathAndName)
del File
try {
    String filePath = filePathAndName;
    filePath = filePath.toString();
    java.io.File myDelFile = new java.io.File(filePath);
    myDelFile.delete();
} catch (Exception e) {
    e.printStackTrace();
voiddelFile(String filePathAndName)
del File
java.io.File myDelFile = new java.io.File(filePathAndName);
if (myDelFile.exists()) {
    myDelFile.delete();
voiddelFile(String filePathAndName)
del File
try {
    String filePath = filePathAndName;
    filePath = filePath.toString();
    java.io.File myDelFile = new java.io.File(filePath);
    myDelFile.delete();
} catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
...
voidDelFile(String in_Path, ArrayList arrFileList)
Del File
for (int i = 0; i < arrFileList.size(); i++) {
    String sFile = (String) arrFileList.get(i);
    File delFile = new File(sFile);
    delFile.delete();
voiddelFile(String path)
del File
File file = new File(path);
if (file.exists() && file.isFile()) {
    file.delete();
} else if (file.exists() && file.isDirectory()) {
    File[] files = file.listFiles();
    if (files != null) {
        for (File f : files) {
            if (f != null) {
...
booleandelFile(String pathName)
del File
File path = new File(pathName);
return delFile(path);
voiddelFileIfExists(String path)
del File If Exists
File f = new File(path);
if (f.exists()) {
    delFile(f);