Here you can find the source of deleteTemp(String tempPath)
public static File deleteTemp(String tempPath)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static File deleteTemp(String tempPath) { File tempFile = new File(tempPath); if (tempFile.exists()) { deleteFile(tempFile);/*from w w w. j av a 2 s .c o m*/ } return tempFile; } private static void deleteFile(File file) { if (file.exists()) { if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File[] files = file.listFiles(); if (files != null) { for (File file1 : files) { deleteFile(file1); } } file.delete(); } } } }