Here you can find the source of deleteFile(String path)
Parameter | Description |
---|---|
path | - file path |
public static boolean deleteFile(String path)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { /**/*from w ww . jav a 2s. c om*/ * Delete file according to a path. * * @param path * - file path * @return - true if delete successfully, otherwise false. */ public static boolean deleteFile(String path) { File file = new File(path); return deleteFile(file); } /** * Delete file. * * @param file * - deleted file * @return - true if delete successfully, otherwise false. */ public static boolean deleteFile(File file) { boolean flag = false; if (file.exists() && file.isFile()) { file.delete(); flag = true; } return flag; } }