Example usage for java.io File delete

List of usage examples for java.io File delete

Introduction

In this page you can find the example usage for java.io File delete.

Prototype

public boolean delete() 

Source Link

Document

Deletes the file or directory denoted by this abstract pathname.

Usage

From source file:Main.java

public static void deleteAllFromPath(String path) {
    File folder = new File(path);
    if (null != folder) {
        File[] files = folder.listFiles();
        for (File file : files)
            file.delete();
    }//from ww  w. ja  va2s  . c  om
}

From source file:Main.java

/**
 * Delete the database file in the current path
 *
 * @param context the current Activity context
 * @param path    the database file/*from  w  w w. j  a  v  a  2s .  c o m*/
 */
private static void deleteDatabase(Activity context, String path) {
    File dbFile = new File(path);
    dbFile.delete();
}

From source file:Main.java

public static void deleteAllFile(String path) {
    File file = new File(path);
    File[] files = file.listFiles();
    if (files != null) {
        for (File pFile : files) {
            pFile.delete();
        }/*www  .j  a  v a 2s  .c o  m*/
    }
}

From source file:Main.java

public static synchronized boolean deleteFile(String filename) {
    File file = new File(filename);
    return file.delete();
}

From source file:Main.java

private static boolean deleteFromXML(String name) {
    File file = new File(path, name);
    return file.delete();
}

From source file:Main.java

public static boolean deleteFile(final String path) {
    File photo = new File(path);

    return photo.delete();
}

From source file:Main.java

public static boolean deleteFile(String locationSrc) {
    File sdpath = new File(locationSrc);
    return sdpath.delete();

}

From source file:Main.java

public static final void clearFolder(String path) {
    File tempFolder = new File(path);
    if (tempFolder.exists()) {
        File[] tempFiles = tempFolder.listFiles();
        for (File tempFile : tempFiles) {
            tempFile.delete();
        }//from  w  w  w  . ja  v a 2  s  .  co m
    }
}

From source file:Main.java

protected static void removeFiles(List<String> filesToRemove) {
    for (String filename : filesToRemove) {
        File datafile = new File(filename);
        datafile.delete();
    }/*from   ww w .j  a  va 2s.  co  m*/
}

From source file:Main.java

private static void deleteFilesByDirectory(File directory) {
    if ((directory != null) && directory.exists() && directory.isDirectory()) {
        for (File item : directory.listFiles()) {
            item.delete();
        }/* w w w .j a  va  2 s .  c o m*/
    }
}