Here you can find the source of deleteFile(String filename)
Parameter | Description |
---|---|
filename | the pathname of the file to erase. |
true
if and only if the file is successfully deleted; false
otherwise.
public static boolean deleteFile(String filename)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013-2015 UAH Space Research Group. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w ww .jav a 2s . c o m*/ * MICOBS SRG Team - Initial API and implementation ******************************************************************************/ import java.io.File; public class Main { /** * Deletes a file from the file system. * @param filename the pathname of the file to erase. * @return <code>true</code> if and only if the file is * successfully deleted; <code>false</code> otherwise. */ public static boolean deleteFile(String filename) { File file2Delete = new File(filename); return file2Delete.delete(); } }