Here you can find the source of deleteFile(String filePath)
Parameter | Description |
---|---|
String | filePath |
public static boolean deleteFile(String filePath)
//package com.java2s; /*/* ww w. j av a2 s . co m*/ * JLib - Publicitas Java library v1.2.0. * * Copyright (c) 2005, 2006, 2007, 2008, 2009 Publicitas SA. * Licensed under LGPL (LGPL-LICENSE.txt) license. */ import java.io.File; public class Main { /** * Delete the file targeted by the filePath * @param String filePath * @return Boolean isDeleted * !!! the method returns false if : * - the filePath targets a folder * - the file does not exist * - the file is locked */ public static boolean deleteFile(String filePath) { File fileToDelete = new File(filePath); if (!fileToDelete.isFile()) return false; return fileToDelete.delete(); } }