public static boolean deleteFile(String path) { In Flag Boolean = to false ; // path database stores path File File = new new File (relative path + path); // path to the file is not empty then delete IF (file.isFile ()) { file.delete(); flag = true; } return flag; }