Here you can find the source of deleteFile(File file)
public static void deleteFile(File file) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *******************************************************************************/ import java.io.File; import java.io.IOException; public class Main { public static void deleteFile(File file) throws IOException { if (file == null || !file.exists()) { return; }//w w w . j a v a 2s . c o m if (!file.delete()) { throw new IOException("Can't delete file : " + file.getPath()); } } /** * Gets the path name for a given file name * * @param file The file name to process * @return The name of the path to the given file */ public static String getPath(File file) { return getPath(file.toString()); } /** * Gets the path name for a given file name * * @param file The file name to process * @return The name of the path to the given file */ public static String getPath(String file) { // return StringUtils.getLeftLast(file, "/") + "/"; return ""; } }